Do proper cleanup of event handlers in wxWebKitCtrl and wxMacUnicodeTextCtrl, and unset the window focus when destroying a top level window to ensure that controls do not receive events after the wx portion of the control has been destroyed.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56767 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -103,6 +103,7 @@ protected :
|
||||
|
||||
// contains the tag for the content (is different for password and non-password controls)
|
||||
OSType m_valueTag ;
|
||||
WXEVENTHANDLERREF m_macTextCtrlEventHandler ;
|
||||
public :
|
||||
ControlEditTextSelectionRec m_selection ;
|
||||
};
|
||||
|
@@ -49,6 +49,8 @@ public:
|
||||
|
||||
virtual ~wxTopLevelWindowMac();
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
||||
// Attracts the users attention to this window if the application is
|
||||
|
@@ -468,7 +468,16 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
|
||||
|
||||
wxWebKitCtrl::~wxWebKitCtrl()
|
||||
{
|
||||
MyFrameLoadMonitor* myFrameLoadMonitor = [m_webView frameLoadDelegate];
|
||||
MyPolicyDelegate* myPolicyDelegate = [m_webView policyDelegate];
|
||||
[m_webView setFrameLoadDelegate: nil];
|
||||
[m_webView setPolicyDelegate: nil];
|
||||
|
||||
if (myFrameLoadMonitor)
|
||||
[myFrameLoadMonitor release];
|
||||
|
||||
if (myPolicyDelegate)
|
||||
[myPolicyDelegate release];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1393,13 +1393,14 @@ bool wxMacUnicodeTextControl::Create( wxTextCtrl *wxPeer,
|
||||
|
||||
InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(),
|
||||
GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this,
|
||||
NULL);
|
||||
(EventHandlerRef*) &m_macTextCtrlEventHandler);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxMacUnicodeTextControl::~wxMacUnicodeTextControl()
|
||||
{
|
||||
::RemoveEventHandler((EventHandlerRef) m_macTextCtrlEventHandler);
|
||||
}
|
||||
|
||||
void wxMacUnicodeTextControl::VisibilityChanged(bool shown)
|
||||
|
@@ -970,6 +970,16 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::Destroy()
|
||||
{
|
||||
// NB: this will get called during destruction if we don't do it now,
|
||||
// and may fire a kill focus event on a control being destroyed
|
||||
if (m_macWindow)
|
||||
ClearKeyboardFocus( (WindowRef)m_macWindow );
|
||||
|
||||
return wxTopLevelWindowBase::Destroy();
|
||||
}
|
||||
|
||||
wxTopLevelWindowMac::~wxTopLevelWindowMac()
|
||||
{
|
||||
if ( m_macWindow )
|
||||
|
Reference in New Issue
Block a user