From c6212a0cb7e6285f62198a9411d91bbe8dc06e60 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 20 Jan 2009 18:33:33 +0000 Subject: [PATCH] set m_isBeingDeleted to true (only) in SendDestroyEvent(); call it as early as possible during the window destruction to ensure that destroy event handlers can still access the full window object git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/control.h | 1 - include/wx/os2/control.h | 1 - include/wx/osx/control.h | 1 - include/wx/window.h | 3 ++- src/aui/auibook.cpp | 2 +- src/cocoa/window.mm | 1 - src/common/wincmn.cpp | 14 +++++++++++++- src/dfb/nonownedwnd.cpp | 2 +- src/dfb/window.cpp | 2 -- src/gtk/dialog.cpp | 2 -- src/gtk/frame.cpp | 3 ++- src/gtk/toplevel.cpp | 2 +- src/gtk/window.cpp | 4 +--- src/gtk1/frame.cpp | 3 ++- src/gtk1/toplevel.cpp | 2 +- src/gtk1/window.cpp | 2 -- src/mgl/window.cpp | 2 -- src/motif/dialog.cpp | 2 +- src/motif/frame.cpp | 2 +- src/motif/window.cpp | 4 ++-- src/msw/control.cpp | 9 --------- src/msw/dialog.cpp | 2 -- src/msw/frame.cpp | 3 ++- src/msw/radiobox.cpp | 2 +- src/msw/toplevel.cpp | 2 ++ src/msw/window.cpp | 5 +---- src/os2/control.cpp | 5 ----- src/os2/dialog.cpp | 2 +- src/os2/frame.cpp | 3 ++- src/os2/radiobox.cpp | 2 +- src/os2/window.cpp | 2 +- src/osx/carbon/control.cpp | 5 ----- src/osx/carbon/drawer.cpp | 42 +++++++++++++++++++++--------------------- src/osx/carbon/frame.cpp | 5 +++-- src/osx/dialog_osx.cpp | 2 +- src/osx/nonownedwnd_osx.cpp | 2 +- src/osx/radiobox_osx.cpp | 6 +++--- src/osx/window_osx.cpp | 2 -- src/palmos/control.cpp | 3 ++- src/univ/dialog.cpp | 2 -- src/univ/winuniv.cpp | 2 +- src/x11/window.cpp | 2 -- 42 files changed, 71 insertions(+), 94 deletions(-) diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index 20d9c73..3288843 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -35,7 +35,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxControlNameStr); - virtual ~wxControl(); // Simulates an event virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } diff --git a/include/wx/os2/control.h b/include/wx/os2/control.h index dd70765..0fc4cee 100644 --- a/include/wx/os2/control.h +++ b/include/wx/os2/control.h @@ -32,7 +32,6 @@ public: { Create( pParent, vId, rPos, rSize, lStyle, rValidator, rsName ); } - virtual ~wxControl(); bool Create( wxWindow* pParent ,wxWindowID vId diff --git a/include/wx/osx/control.h b/include/wx/osx/control.h index 8d7f265..123ab77 100644 --- a/include/wx/osx/control.h +++ b/include/wx/osx/control.h @@ -35,7 +35,6 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxControlNameStr); - virtual ~wxControl(); // Simulates an event virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } diff --git a/include/wx/window.h b/include/wx/window.h index 04b443a..3a626d5 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -1402,7 +1402,8 @@ protected: void SatisfyConstraints(); #endif // wxUSE_CONSTRAINTS - // Send the wxWindowDestroyEvent + // Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted + // to true void SendDestroyEvent(); // returns the main window of composite control; this is the window diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 607722c..690acc0 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -2898,7 +2898,7 @@ void wxAuiNotebook::InitNotebook(long style) wxAuiNotebook::~wxAuiNotebook() { // Indicate we're deleting pages - m_isBeingDeleted = true; + SendDestroyEvent(); while ( GetPageCount() > 0 ) DeletePage(0); diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 5b54eb7..3cee0cb 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -943,7 +943,6 @@ void wxWindowCocoa::Init() m_cocoaNSView = NULL; m_cocoaHider = NULL; m_wxCocoaScrollView = NULL; - m_isBeingDeleted = false; m_isInPaint = false; m_visibleTrackingRectManager = NULL; } diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 57a451e..5192410 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -209,7 +209,9 @@ wxWindowBase::wxWindowBase() // Whether we're using the current theme for this window (wxGTK only for now) m_themeEnabled = false; - // VZ: this one shouldn't exist... + // This is set to true by SendDestroyEvent() which should be called by the + // most derived class to ensure that the destruction event is sent as soon + // as possible to allow its handlers to still see the undestroyed window m_isBeingDeleted = false; m_freezeCount = 0; @@ -387,6 +389,16 @@ bool wxWindowBase::IsBeingDeleted() const void wxWindowBase::SendDestroyEvent() { + if ( m_isBeingDeleted ) + { + // we could have been already called from a more derived class dtor, + // e.g. ~wxTLW calls us and so does ~wxWindow and the latter call + // should be simply ignored + return; + } + + m_isBeingDeleted = true; + wxWindowDestroyEvent event; event.SetEventObject(this); event.SetId(GetId()); diff --git a/src/dfb/nonownedwnd.cpp b/src/dfb/nonownedwnd.cpp index d776693..c455d5e 100644 --- a/src/dfb/nonownedwnd.cpp +++ b/src/dfb/nonownedwnd.cpp @@ -153,7 +153,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, wxNonOwnedWindow::~wxNonOwnedWindow() { - m_isBeingDeleted = true; + SendDestroyEvent(); // destroy all children before we destroy the underlying DirectFB window, // so that if any of them does something with the TLW, it will still work: diff --git a/src/dfb/window.cpp b/src/dfb/window.cpp index cbc67d4..548616b 100644 --- a/src/dfb/window.cpp +++ b/src/dfb/window.cpp @@ -88,8 +88,6 @@ wxWindowDFB::~wxWindowDFB() { SendDestroyEvent(); - m_isBeingDeleted = true; - if ( gs_mouseCapture == this ) ReleaseMouse(); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 8c40909..0100682 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -85,8 +85,6 @@ bool wxDialog::Show( bool show ) wxDialog::~wxDialog() { - m_isBeingDeleted = true; - // if the dialog is modal, this will end its event loop if ( IsModal() ) EndModal(wxID_CANCEL); diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 118148b..2fb0d7c 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -56,7 +56,8 @@ bool wxFrame::Create( wxWindow *parent, wxFrame::~wxFrame() { - m_isBeingDeleted = true; + SendDestroyEvent(); + DeleteAllBars(); } diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index caffefc..8990d42 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -665,7 +665,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() RemoveGrab(); } - m_isBeingDeleted = true; + SendDestroyEvent(); // it may also be GtkScrolledWindow in the case of an MDI child if (GTK_IS_WINDOW(m_widget)) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9b01412..c66ad43 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2040,9 +2040,8 @@ void wxWindowGTK::Init() m_height = 0; m_hasVMT = false; - m_isBeingDeleted = false; - m_showOnIdle= false; + m_showOnIdle = false; m_noExpose = false; m_nativeSizeEvent = false; @@ -2210,7 +2209,6 @@ wxWindowGTK::~wxWindowGTK() if ( gs_deferredFocusOut == this ) gs_deferredFocusOut = NULL; - m_isBeingDeleted = true; m_hasVMT = false; // destroy children before destroying this window itself diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 2e3f915..94e99c0 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -229,7 +229,8 @@ bool wxFrame::Create( wxWindow *parent, wxFrame::~wxFrame() { - m_isBeingDeleted = true; + SendDestroyEvent(); + DeleteAllBars(); } diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index ccc04cf..3709037 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -660,7 +660,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() RemoveGrab(); } - m_isBeingDeleted = true; + SendDestroyEvent(); // it may also be GtkScrolledWindow in the case of an MDI child if (GTK_IS_WINDOW(m_widget)) diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 7061e1e..ba93c71 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2437,7 +2437,6 @@ void wxWindowGTK::Init() m_sizeSet = false; m_hasVMT = false; m_needParent = true; - m_isBeingDeleted = false; m_noExpose = false; m_nativeSizeEvent = false; @@ -2613,7 +2612,6 @@ wxWindowGTK::~wxWindowGTK() if ( g_delayedFocus == this ) g_delayedFocus = NULL; - m_isBeingDeleted = true; m_hasVMT = false; // destroy children before destroying this window itself diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 5ad62e9..275d2e8 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -559,8 +559,6 @@ wxWindowMGL::~wxWindowMGL() { SendDestroyEvent(); - m_isBeingDeleted = true; - if ( gs_mouseCapture == this ) ReleaseMouse(); diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 3955a68..347e113 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -181,7 +181,7 @@ void wxDialog::SetModal(bool flag) wxDialog::~wxDialog() { - m_isBeingDeleted = true; + SendDestroyEvent(); // if the dialog is modal, this will end its event loop Show(false); diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index aa9c013..c32ec0a 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -253,7 +253,7 @@ bool wxFrame::XmDoCreateTLW(wxWindow* WXUNUSED(parent), wxFrame::~wxFrame() { - m_isBeingDeleted = true; + SendDestroyEvent(); if (m_clientArea) { diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 32f3dab..116998f 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -345,11 +345,11 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, // Destructor wxWindow::~wxWindow() { + SendDestroyEvent(); + if (g_captureWindow == this) g_captureWindow = NULL; - m_isBeingDeleted = true; - // Motif-specific actions first WXWidget wMain = GetMainWidget(); if ( wMain ) diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 745e9bd..5c1740d 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -60,15 +60,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) // ============================================================================ // ---------------------------------------------------------------------------- -// wxControl ctor/dtor -// ---------------------------------------------------------------------------- - -wxControl::~wxControl() -{ - m_isBeingDeleted = true; -} - -// ---------------------------------------------------------------------------- // control window creation // ---------------------------------------------------------------------------- diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index c7baa03..55bd004 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -192,8 +192,6 @@ bool wxDialog::Create(wxWindow *parent, wxDialog::~wxDialog() { - m_isBeingDeleted = true; - // this will also reenable all the other windows for a modal dialog Show(false); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index c81d5c6..bf2b9db 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -209,7 +209,8 @@ bool wxFrame::Create(wxWindow *parent, wxFrame::~wxFrame() { - m_isBeingDeleted = true; + SendDestroyEvent(); + DeleteAllBars(); } diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 26519ad..cdf5141 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -254,7 +254,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxRadioBox::~wxRadioBox() { - m_isBeingDeleted = true; + SendDestroyEvent(); delete m_radioButtons; if ( m_dummyHwnd ) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 4ab3090..1739212 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -599,6 +599,8 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, wxTopLevelWindowMSW::~wxTopLevelWindowMSW() { + SendDestroyEvent(); + #if defined(__SMARTPHONE__) || defined(__POCKETPC__) SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo; delete info; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index ea0ffb1..3707a1b 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -518,7 +518,6 @@ bool wxWindowMSW::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) void wxWindowMSW::Init() { // MSW specific - m_isBeingDeleted = false; m_oldWndProc = NULL; m_mouseInWindow = false; m_lastKeydownProcessed = false; @@ -540,7 +539,7 @@ void wxWindowMSW::Init() // Destructor wxWindowMSW::~wxWindowMSW() { - m_isBeingDeleted = true; + SendDestroyEvent(); #ifndef __WXUNIVERSAL__ // VS: make sure there's no wxFrame with last focus set to us: @@ -3949,8 +3948,6 @@ bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT WXUNUSED_IN_WINCE(cs), bool wxWindowMSW::HandleDestroy() { - SendDestroyEvent(); - // delete our drop target if we've got one #if wxUSE_DRAG_AND_DROP if ( m_dropTarget != NULL ) diff --git a/src/os2/control.cpp b/src/os2/control.cpp index 0c53e23..4bbf875 100644 --- a/src/os2/control.cpp +++ b/src/os2/control.cpp @@ -60,11 +60,6 @@ bool wxControl::Create( wxWindow* pParent, return bRval; } // end of wxControl::Create -wxControl::~wxControl() -{ - m_isBeingDeleted = true; -} - bool wxControl::OS2CreateControl( const wxChar* zClassname, const wxString& rsLabel, const wxPoint& rPos, diff --git a/src/os2/dialog.cpp b/src/os2/dialog.cpp index 8a56bef..0f299aa 100644 --- a/src/os2/dialog.cpp +++ b/src/os2/dialog.cpp @@ -147,7 +147,7 @@ void wxDialog::SetModal(bool WXUNUSED(bFlag)) wxDialog::~wxDialog() { - m_isBeingDeleted = true; + SendDestroyEvent(); // this will also reenable all the other windows for a modal dialog Show(false); diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 57db7de..cc78c86 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -127,7 +127,8 @@ bool wxFrame::Create( wxWindow* pParent, wxFrame::~wxFrame() { - m_isBeingDeleted = true; + SendDestroyEvent(); + DeleteAllBars(); } // end of wxFrame::~wxFrame diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index 6b09f22..19ff8a2 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -76,7 +76,7 @@ wxRadioBox::wxRadioBox() wxRadioBox::~wxRadioBox() { - m_isBeingDeleted = true; + SendDestroyEvent(); if (m_hWnd) wxRemoveHandleAssociation(this); diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 409b611..3654838 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -334,7 +334,7 @@ void wxWindowOS2::Init() // wxWindowOS2::~wxWindowOS2() { - m_isBeingDeleted = true; + SendDestroyEvent(); for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent()) { diff --git a/src/osx/carbon/control.cpp b/src/osx/carbon/control.cpp index 00114ba..7f406f3 100644 --- a/src/osx/carbon/control.cpp +++ b/src/osx/carbon/control.cpp @@ -63,11 +63,6 @@ bool wxControl::Create( wxWindow *parent, return rval; } -wxControl::~wxControl() -{ - m_isBeingDeleted = true; -} - bool wxControl::ProcessCommand( wxCommandEvent &event ) { // Tries: diff --git a/src/osx/carbon/drawer.cpp b/src/osx/carbon/drawer.cpp index 36dc09d..0af7609 100644 --- a/src/osx/carbon/drawer.cpp +++ b/src/osx/carbon/drawer.cpp @@ -4,7 +4,7 @@ // Drawer windows appear under their parent window and // behave like a drawer, opening and closing to reveal // content that does not need to be visible at all times. -// Author: Jason Bagley +// Author: Jason Bagley // Modified by: Ryan Norton (To make it work :), plus bug fixes) // Created: 2004-30-01 // RCS-ID: $Id$ @@ -40,17 +40,17 @@ wxDrawerWindow::wxDrawerWindow() } wxDrawerWindow::~wxDrawerWindow() -{ - m_isBeingDeleted = TRUE; - this->Show(FALSE); +{ + SendDestroyEvent(); + Show(FALSE); } - + bool wxDrawerWindow::Create(wxWindow *parent, wxWindowID id, const wxString& title, wxSize size, wxDirection edge, const wxString& name) { wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window.")); - + // Constrain the drawer size to the parent window. const wxSize parentSize(parent->GetClientSize()); if (wxLEFT == edge || wxRIGHT == edge) @@ -63,25 +63,25 @@ bool wxDrawerWindow::Create(wxWindow *parent, if (size.GetWidth() > parentSize.GetWidth()) size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset)); } - - // Create the drawer window. + + // Create the drawer window. const wxPoint pos(0, 0); const wxSize dummySize(0,0); const long style = wxFRAME_DRAWER; - + bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name); if (success) { // this->MacCreateRealWindow(pos, size, style, name); success = (GetWXWindow() != NULL); } - + if (success) { // Use drawer brush. SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) ); ::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false); - + // Leading and trailing offset are gaps from parent window edges // to where the drawer starts. ::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset); @@ -90,7 +90,7 @@ bool wxDrawerWindow::Create(wxWindow *parent, // Is there a better way to get the parent's WindowRef? wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow); if (NULL != tlwParent) - { + { OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(), (WindowRef)tlwParent->GetWXWindow()); success = (noErr == status); @@ -98,7 +98,7 @@ bool wxDrawerWindow::Create(wxWindow *parent, else success = false; } - + return success && SetPreferredEdge(edge); } @@ -152,15 +152,15 @@ OptionBits DirectionToWindowEdge(wxDirection direction) case wxTOP: edge = kWindowEdgeTop; break; - + case wxBOTTOM: edge = kWindowEdgeBottom; break; - + case wxRIGHT: edge = kWindowEdgeRight; break; - + case wxLEFT: default: edge = kWindowEdgeLeft; @@ -177,23 +177,23 @@ wxDirection WindowEdgeToDirection(OptionBits edge) case kWindowEdgeTop: direction = wxTOP; break; - + case kWindowEdgeBottom: direction = wxBOTTOM; break; - + case kWindowEdgeRight: direction = wxRIGHT; break; - + case kWindowEdgeDefault: // store current preferred and return that here? case kWindowEdgeLeft: default: direction = wxLEFT; break; } - + return direction; } -#endif // defined( __WXMAC__ ) +#endif // defined( __WXMAC__ ) diff --git a/src/osx/carbon/frame.cpp b/src/osx/carbon/frame.cpp index 1562121..cfa6446 100644 --- a/src/osx/carbon/frame.cpp +++ b/src/osx/carbon/frame.cpp @@ -61,7 +61,8 @@ bool wxFrame::Create(wxWindow *parent, wxFrame::~wxFrame() { - m_isBeingDeleted = true; + SendDestroyEvent(); + DeleteAllBars(); } @@ -362,7 +363,7 @@ void wxFrame::PositionToolBar() int cw, ch; GetSize( &cw , &ch ) ; - + int statusX = 0 ; int statusY = 0 ; diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index fabbf00..fbc3ce6 100644 --- a/src/osx/dialog_osx.cpp +++ b/src/osx/dialog_osx.cpp @@ -71,7 +71,7 @@ void wxDialog::SetModal( bool flag ) wxDialog::~wxDialog() { - m_isBeingDeleted = true; + SendDestroyEvent(); // if the dialog is modal, this will end its event loop Show(false); diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index d8b9e02..2a6f1cf 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -151,7 +151,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, wxNonOwnedWindow::~wxNonOwnedWindow() { - m_isBeingDeleted = true; + SendDestroyEvent(); wxRemoveWXWindowAssociation( this ) ; diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index f6dc751..4ba2abf 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -52,7 +52,7 @@ wxRadioBox::wxRadioBox() wxRadioBox::~wxRadioBox() { - m_isBeingDeleted = true; + SendDestroyEvent(); wxRadioButton *next, *current; @@ -411,7 +411,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) totWidth = GetColumnCount() * (maxWidth + charWidth); wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ; - + // change the width / height only when specified if ( width == wxDefaultCoord ) { @@ -502,7 +502,7 @@ wxSize wxRadioBox::DoGetBestSize() const wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ); totWidth = sz.x; totHeight = sz.y; - + // optimum size is an additional 5 pt border to all sides totWidth += 10; totHeight += 10; diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index ee64a56..8231ba5 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -141,8 +141,6 @@ wxWindowMac::~wxWindowMac() { SendDestroyEvent(); - m_isBeingDeleted = true; - MacInvalidateBorders() ; #ifndef __WXUNIVERSAL__ diff --git a/src/palmos/control.cpp b/src/palmos/control.cpp index 39033e8..66dd535 100644 --- a/src/palmos/control.cpp +++ b/src/palmos/control.cpp @@ -77,8 +77,9 @@ void wxControl::Init() wxControl::~wxControl() { + SendDestroyEvent(); + SetLabel(wxEmptyString); - m_isBeingDeleted = true; DestroyChildren(); diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index c98a5e9..3faf2f7 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -53,8 +53,6 @@ void wxDialog::Init() wxDialog::~wxDialog() { - m_isBeingDeleted = true; - // if the dialog is modal, this will end its event loop Show(false); diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index f623137..41b166c 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -224,7 +224,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindow::~wxWindow() { - m_isBeingDeleted = true; + SendDestroyEvent(); #if wxUSE_SCROLLBAR // clear pointers to scrollbar before deleting the children: they are diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 6cae317..521a80b 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -350,8 +350,6 @@ wxWindowX11::~wxWindowX11() if (g_captureWindow == this) g_captureWindow = NULL; - m_isBeingDeleted = true; - DestroyChildren(); if (m_clientWindow != m_mainWindow) -- 2.7.4