mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
fix so that if our windows get subclassed and we never hear any
WM_DESTROY messages, we still cleanup properly.
This commit is contained in:
parent
bf5c1f7472
commit
ffa719807f
@ -381,6 +381,7 @@ nsWindow::nsWindow()
|
||||
mIsControlDown = PR_FALSE;
|
||||
mIsAltDown = PR_FALSE;
|
||||
mIsDestroying = PR_FALSE;
|
||||
mOnDestroyCalled = PR_FALSE;
|
||||
mTooltip = NULL;
|
||||
mDeferredPositioner = NULL;
|
||||
mLastPoint.x = 0;
|
||||
@ -701,6 +702,14 @@ void nsWindow::Destroy()
|
||||
// prevent the widget from causing additional events
|
||||
mEventCallback = nsnull;
|
||||
VERIFY(::DestroyWindow(mWnd));
|
||||
mWnd = NULL;
|
||||
//our windows can be subclassed by
|
||||
//others and these namless, faceless others
|
||||
//may not let us know about WM_DESTROY. so,
|
||||
//if OnDestroy() didn't get called, just call
|
||||
//it now. MMP
|
||||
if (PR_FALSE == mOnDestroyCalled)
|
||||
OnDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1767,6 +1776,7 @@ DWORD nsWindow::WindowExStyle()
|
||||
// -----------------------------------------------------------------------
|
||||
void nsWindow::SubclassWindow(BOOL bState)
|
||||
{
|
||||
if (NULL != mWnd) {
|
||||
NS_PRECONDITION(::IsWindow(mWnd), "Invalid window handle");
|
||||
|
||||
if (bState) {
|
||||
@ -1782,6 +1792,7 @@ void nsWindow::SubclassWindow(BOOL bState)
|
||||
::SetWindowLong(mWnd, GWL_USERDATA, (LONG)NULL);
|
||||
mPrevWndProc = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1792,6 +1803,8 @@ void nsWindow::SubclassWindow(BOOL bState)
|
||||
//-------------------------------------------------------------------------
|
||||
void nsWindow::OnDestroy()
|
||||
{
|
||||
mOnDestroyCalled = PR_TRUE;
|
||||
|
||||
SubclassWindow(FALSE);
|
||||
mWnd = NULL;
|
||||
|
||||
|
@ -196,6 +196,7 @@ protected:
|
||||
PRBool mIsControlDown;
|
||||
PRBool mIsAltDown;
|
||||
PRBool mIsDestroying;
|
||||
PRBool mOnDestroyCalled;
|
||||
|
||||
PRInt32 mWidth;
|
||||
PRInt32 mHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user