Added code to Ondestroy() to do an AddRef() before calling DispatchStandardEvent()

and then a Release() afterwards. This ensures the object doesn't get destroyed until
after we've dispatched the event
This commit is contained in:
troy%netscape.com 1998-08-06 02:11:43 +00:00
parent 032ca1e974
commit c876b84e2e

View File

@ -1737,7 +1737,15 @@ void nsWindow::OnDestroy()
NS_RELEASE(mToolkit);
mToolkit = NULL;
}
DispatchStandardEvent(NS_DESTROY);
if (!mIsDestroying) {
// Dispatching of the event may cause the reference count to drop to 0
// and result in this object being destroyed. To avoid that, add a reference
// and then release it after dispatching the event
AddRef();
DispatchStandardEvent(NS_DESTROY);
Release();
}
}
//-------------------------------------------------------------------------