mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 557557 - Properly handle destruction in taskbar previews when the window outlives the preview r=jimm
This commit is contained in:
parent
4dddc1fb4e
commit
e033b38382
@ -112,9 +112,8 @@ TaskbarPreview::~TaskbarPreview() {
|
||||
if (sActivePreview == this)
|
||||
sActivePreview = nsnull;
|
||||
|
||||
// Here we remove the hook since this preview is dying before the nsWindow
|
||||
if (mWnd)
|
||||
DetachFromNSWindow(PR_TRUE);
|
||||
// Our subclass should have invoked DetachFromNSWindow already.
|
||||
NS_ASSERTION(!mWnd, "TaskbarPreview::DetachFromNSWindow was not called before destruction");
|
||||
|
||||
// Make sure to release before potentially uninitializing COM
|
||||
mTaskbar = NULL;
|
||||
@ -240,11 +239,9 @@ TaskbarPreview::Disable() {
|
||||
}
|
||||
|
||||
void
|
||||
TaskbarPreview::DetachFromNSWindow(PRBool windowIsAlive) {
|
||||
if (windowIsAlive) {
|
||||
WindowHook &hook = GetWindowHook();
|
||||
hook.RemoveMonitor(WM_DESTROY, MainWindowHook, this);
|
||||
}
|
||||
TaskbarPreview::DetachFromNSWindow() {
|
||||
WindowHook &hook = GetWindowHook();
|
||||
hook.RemoveMonitor(WM_DESTROY, MainWindowHook, this);
|
||||
mWnd = NULL;
|
||||
}
|
||||
|
||||
@ -395,9 +392,8 @@ TaskbarPreview::MainWindowHook(void *aContext,
|
||||
TaskbarPreview *preview = reinterpret_cast<TaskbarPreview*>(aContext);
|
||||
if (nMsg == WM_DESTROY) {
|
||||
// nsWindow is being destroyed
|
||||
// Don't remove the hook since it is currently in dispatch
|
||||
// and the window is being destroyed
|
||||
preview->DetachFromNSWindow(PR_FALSE);
|
||||
// We can't really do anything at this point including removing hooks
|
||||
preview->mWnd = NULL;
|
||||
} else {
|
||||
nsWindow *window = nsWindow::GetNSWindowPtr(preview->mWnd);
|
||||
NS_ASSERTION(window, "Cannot use taskbar previews in an embedded context!");
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
virtual nsresult Disable();
|
||||
|
||||
// Detaches this preview from the nsWindow instance it's tied to
|
||||
virtual void DetachFromNSWindow(PRBool windowIsAlive);
|
||||
virtual void DetachFromNSWindow();
|
||||
|
||||
// Marks this preview as being active
|
||||
virtual nsresult ShowActive(PRBool active) = 0;
|
||||
|
@ -69,8 +69,8 @@ TaskbarTabPreview::~TaskbarTabPreview() {
|
||||
::DestroyIcon(mIcon);
|
||||
mIcon = NULL;
|
||||
}
|
||||
// Do this here because this is our last chance to execute methods in this class
|
||||
(void) SetVisible(PR_FALSE);
|
||||
if (mWnd)
|
||||
DetachFromNSWindow();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -265,15 +265,12 @@ TaskbarTabPreview::Disable() {
|
||||
}
|
||||
|
||||
void
|
||||
TaskbarTabPreview::DetachFromNSWindow(PRBool windowIsAlive) {
|
||||
TaskbarTabPreview::DetachFromNSWindow() {
|
||||
(void) SetVisible(PR_FALSE);
|
||||
WindowHook &hook = GetWindowHook();
|
||||
hook.RemoveMonitor(WM_WINDOWPOSCHANGED, MainWindowHook, this);
|
||||
|
||||
if (windowIsAlive) {
|
||||
WindowHook &hook = GetWindowHook();
|
||||
hook.RemoveMonitor(WM_WINDOWPOSCHANGED, MainWindowHook, this);
|
||||
}
|
||||
|
||||
TaskbarPreview::DetachFromNSWindow(windowIsAlive);
|
||||
TaskbarPreview::DetachFromNSWindow();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -69,7 +69,7 @@ private:
|
||||
virtual nsresult UpdateTaskbarProperties();
|
||||
virtual nsresult Enable();
|
||||
virtual nsresult Disable();
|
||||
virtual void DetachFromNSWindow(PRBool windowIsAlive);
|
||||
virtual void DetachFromNSWindow();
|
||||
|
||||
// WindowHook procedure for hooking mWnd
|
||||
static PRBool MainWindowHook(void *aContext,
|
||||
|
@ -102,7 +102,7 @@ TaskbarWindowPreview::TaskbarWindowPreview(ITaskbarList4 *aTaskbar, nsITaskbarPr
|
||||
|
||||
TaskbarWindowPreview::~TaskbarWindowPreview() {
|
||||
if (mWnd)
|
||||
DetachFromNSWindow(PR_TRUE);
|
||||
DetachFromNSWindow();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -272,18 +272,16 @@ TaskbarWindowPreview::Disable() {
|
||||
}
|
||||
|
||||
void
|
||||
TaskbarWindowPreview::DetachFromNSWindow(PRBool windowIsAlive) {
|
||||
if (windowIsAlive) {
|
||||
// Remove the hooks we have for drawing
|
||||
SetEnableCustomDrawing(PR_FALSE);
|
||||
TaskbarWindowPreview::DetachFromNSWindow() {
|
||||
// Remove the hooks we have for drawing
|
||||
SetEnableCustomDrawing(PR_FALSE);
|
||||
|
||||
WindowHook &hook = GetWindowHook();
|
||||
(void) hook.RemoveHook(WM_COMMAND, WindowHookProc, this);
|
||||
(void) hook.RemoveMonitor(nsAppShell::GetTaskbarButtonCreatedMessage(),
|
||||
TaskbarProgressWindowHook, this);
|
||||
}
|
||||
WindowHook &hook = GetWindowHook();
|
||||
(void) hook.RemoveHook(WM_COMMAND, WindowHookProc, this);
|
||||
(void) hook.RemoveMonitor(nsAppShell::GetTaskbarButtonCreatedMessage(),
|
||||
TaskbarProgressWindowHook, this);
|
||||
|
||||
TaskbarPreview::DetachFromNSWindow(windowIsAlive);
|
||||
TaskbarPreview::DetachFromNSWindow();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -75,7 +75,7 @@ private:
|
||||
virtual nsresult UpdateTaskbarProperties();
|
||||
virtual nsresult Enable();
|
||||
virtual nsresult Disable();
|
||||
virtual void DetachFromNSWindow(PRBool windowIsAlive);
|
||||
virtual void DetachFromNSWindow();
|
||||
nsresult UpdateButton(PRUint32 index);
|
||||
nsresult UpdateButtons();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user