Fix segfault when dragging mouse out of mainmenu window (#1910)