* src/nsterm.m (ns_destroy_window): Close the window before freeing
the frame resources so we don't end up accessing the frame struct
after it's been freed.
(cherry picked from commit
18a7267c32a909bb26bd93d24543155aeb10e042)
{
NSTRACE ("ns_destroy_window");
+ check_window_system (f);
+
/* If this frame has a parent window, detach it as not doing so can
cause a crash in GNUStep. */
if (FRAME_PARENT_FRAME (f) != NULL)
[parent removeChildWindow: child];
}
- check_window_system (f);
+ [[FRAME_NS_VIEW (f) window] close];
ns_free_frame_resources (f);
ns_window_num--;
}