[ wxwindows-Patches-1678304 ] Access to freed window when closing MDI child frame

SourceForge.net noreply at sourceforge.net
Tue May 1 04:55:26 PDT 2007


Patches item #1678304, was opened at 2007-03-11 14:13
Message generated for change (Comment added) made by csomor
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1678304&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Mac specific
Group: bug fix
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: yoavgo (yoavgo)
Assigned to: Stefan Csomor (csomor)
Summary: Access to freed window when closing MDI child frame

Initial Comment:
When closing an MDI child frame, the window's destructor is called. During the destruction,
- wxWindowBase::~wxWindowBase calls the MDI parent's RemoveChild, passing this (which points to the object being destructed);
- If this is the last open child, the parent calls Show to show the MDI parent, so that the menu bar will be updated.
- Show causes an Activate event to be sent to the MDI parent, and this event is handled in wxTopLevelWindowMac::MacActivate.
- MacActivate calls MacDelayedDeactivation.
- In MacDelayedDeactivation there's a call to s_macDeactivateWindow->MacActivate(timestamp, false).

However, s_macDeactivateWindow points to the child being destructed; thus we're trying to access code of a destructed object and we crash.

The patch ensures we don't do that by setting s_macDeactivateWindow to NULL at the end of wxTopLevelWindowMac's destructor, if s_macDeactivateWindow equals this.


----------------------------------------------------------------------

>Comment By: Stefan Csomor (csomor)
Date: 2007-05-01 13:55

Message:
Logged In: YES 
user_id=81467
Originator: NO

committed, thanks for the patch

Stefan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1678304&group_id=9863




More information about the wx-dev mailing list