diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-03 19:39:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-03 19:39:48 +0000 |
commit | 008bd05ba494fb8124d79426681c693a4d246531 (patch) | |
tree | ed76498d6bad717272d5a7d86c3296153b774646 /src | |
parent | 7f0572d75b8e2814ef6117c9ab6c13bdfc2571b0 (diff) |
fix for the forced unsubclassing
git-svn-id: http://svn.miranda-ng.org/main/trunk@13984 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/src/subclass.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/mir_core/src/subclass.cpp b/src/mir_core/src/subclass.cpp index ba7b2e5aa5..76d790f041 100644 --- a/src/mir_core/src/subclass.cpp +++ b/src/mir_core/src/subclass.cpp @@ -119,6 +119,16 @@ static void removeHook(MSubclassData *p, int idx) p->m_iHooks--;
}
+static WNDPROC finalizeSubclassing(HWND hWnd, MSubclassData *p)
+{
+ WNDPROC saveProc = p->m_origWndProc;
+ arSubclass.remove(p);
+ delete p;
+
+ SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)saveProc);
+ return saveProc;
+}
+
MIR_CORE_DLL(void) mir_unsubclassWindow(HWND hWnd, WNDPROC wndProc)
{
MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
@@ -132,10 +142,8 @@ MIR_CORE_DLL(void) mir_unsubclassWindow(HWND hWnd, WNDPROC wndProc) }
}
- if (p->m_iHooks == 0) {
- arSubclass.remove(p);
- delete p;
- }
+ if (p->m_iHooks == 0)
+ finalizeSubclassing(hWnd, p);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -158,11 +166,7 @@ MIR_CORE_DLL(LRESULT) mir_callNextSubclass(HWND hWnd, WNDPROC wndProc, UINT uMsg if (uMsg != WM_NCDESTROY)
return p->m_origWndProc(hWnd, uMsg, wParam, lParam);
- WNDPROC saveProc = p->m_origWndProc;
- arSubclass.remove(p);
- delete p;
-
- SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)saveProc);
+ WNDPROC saveProc = finalizeSubclassing(hWnd, p);
return saveProc(hWnd, uMsg, wParam, lParam);
}
@@ -183,9 +187,7 @@ MIR_CORE_DLL(void) KillModuleSubclassing(HMODULE hInst) }
}
- if (p->m_iHooks == 0) {
- arSubclass.remove(p);
- delete p;
- }
+ if (p->m_iHooks == 0)
+ finalizeSubclassing(p->m_hWnd, p);
}
}
|