fix crash at window destruction

This commit is contained in:
David Rose 2009-03-17 21:39:47 +00:00
parent 7f3641ed49
commit 3d8079f054
2 changed files with 14 additions and 12 deletions

View File

@ -59,7 +59,7 @@ public:
virtual void set_properties_now(WindowProperties &properties); virtual void set_properties_now(WindowProperties &properties);
private: private:
void release_system_resources(); void release_system_resources(bool destructing);
inline void send_key_event(ButtonHandle key, bool down); inline void send_key_event(ButtonHandle key, bool down);
protected: protected:

View File

@ -358,7 +358,7 @@ system_close_window() {
osxdisplay_cat.debug() osxdisplay_cat.debug()
<< "System Closing Window \n"; << "System Closing Window \n";
} }
release_system_resources(); release_system_resources(false);
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -549,7 +549,7 @@ handle_text_input(EventHandlerCallRef my_handler, EventRef text_event) {
// Description: Clean up the OS level messes. // Description: Clean up the OS level messes.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void osxGraphicsWindow:: void osxGraphicsWindow::
release_system_resources() { release_system_resources(bool destructing) {
if (_is_fullscreen) { if (_is_fullscreen) {
_is_fullscreen = false; _is_fullscreen = false;
full_screen_window = NULL; full_screen_window = NULL;
@ -597,12 +597,14 @@ release_system_resources() {
_current_icon = NULL; _current_icon = NULL;
} }
WindowProperties properties; if (!destructing) {
properties.set_foreground(false); WindowProperties properties;
properties.set_open(false); properties.set_foreground(false);
properties.set_cursor_filename(Filename()); properties.set_open(false);
system_changed_properties(properties); properties.set_cursor_filename(Filename());
system_changed_properties(properties);
}
_is_fullscreen = false; _is_fullscreen = false;
_osx_window = NULL; _osx_window = NULL;
} }
@ -670,7 +672,7 @@ osxGraphicsWindow::
SetWRefCon(_osx_window, (long) NULL); SetWRefCon(_osx_window, (long) NULL);
} }
release_system_resources(); release_system_resources(true);
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
@ -989,7 +991,7 @@ close_window() {
properties.set_open(false); properties.set_open(false);
system_changed_properties(properties); system_changed_properties(properties);
release_system_resources(); release_system_resources(false);
_gsg.clear(); _gsg.clear();
_active = false; _active = false;
GraphicsWindow::close_window(); GraphicsWindow::close_window();
@ -1885,7 +1887,7 @@ set_properties_now(WindowProperties &properties) {
// get a copy of my properties.. // get a copy of my properties..
WindowProperties req_properties(_properties); WindowProperties req_properties(_properties);
release_system_resources(); release_system_resources(false);
req_properties.add_properties(properties); req_properties.add_properties(properties);
os_open_window(req_properties); os_open_window(req_properties);