From 34785fc8612845ab31eae94455e662d82341d6bc Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 22 Aug 2008 13:08:41 +0000 Subject: [PATCH] routing SetTitle to SetLabel as MSW does, fixing potential zombie pointers after mouse down events which delete windows git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@55172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/toplevel.h | 1 + src/mac/carbon/toplevel.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/wx/mac/carbon/toplevel.h b/include/wx/mac/carbon/toplevel.h index 53f84f23fc..e6d72de034 100644 --- a/include/wx/mac/carbon/toplevel.h +++ b/include/wx/mac/carbon/toplevel.h @@ -92,6 +92,7 @@ public: virtual void SetTitle( const wxString& title); virtual wxString GetTitle() const; + virtual void SetLabel( const wxString& title); virtual void Raise(); virtual void Lower(); diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 9b019ff439..0afd6cb70c 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -597,8 +597,14 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) ) { + /* + // this code is dangerous in case the delete in the mouse down occured further up in the chain, trying alternative + if ((currentMouseWindowParent != NULL) && (currentMouseWindowParent->GetChildren().Find(currentMouseWindow) == NULL)) + */ + // deleted in the meantime + if ( g_MacLastWindow == NULL ) currentMouseWindow = NULL; result = noErr; @@ -1373,6 +1379,11 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating ) } void wxTopLevelWindowMac::SetTitle(const wxString& title) +{ + SetLabel( title ) ; +} + +void wxTopLevelWindowMac::SetLabel(const wxString& title) { wxWindow::SetLabel( title ) ; UMASetWTitle( (WindowRef)m_macWindow , title , m_font.GetEncoding() ) ;