diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-04 23:00:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-04 23:00:46 +0000 |
commit | 25a50eb1004a71cf5a56b1fc8d6b538bf21a8f71 (patch) | |
tree | 4e36aacf0d573437cea2c94b5bdb471f125be9d5 | |
parent | 0a668c8eb335ba601d97fc7c8dbbecb1c7455408 (diff) |
TTB crashes being unloaded dynamically
git-svn-id: http://svn.miranda-ng.org/main/trunk@2202 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/TopToolBar/src/toolbar.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 87db903dc6..ba97fe87fe 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -596,7 +596,7 @@ int OnPluginUnload(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-int OnModulesLoad(WPARAM wParam, LPARAM lParam)
+static int OnModulesLoad(WPARAM wParam, LPARAM lParam)
{
LoadAllSeparators();
LoadAllLButs();
@@ -615,6 +615,16 @@ int OnModulesLoad(WPARAM wParam, LPARAM lParam) return 0;
}
+static int OnShutdown(WPARAM wParam, LPARAM lParam)
+{
+ if (g_ctrl && g_ctrl->hWnd) {
+ DestroyWindow(g_ctrl->hWnd);
+ g_ctrl->hWnd = NULL;
+ }
+
+ return 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK TTBButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -657,6 +667,7 @@ int LoadToolbarModule() HookEvent(ME_SYSTEM_MODULELOAD, OnPluginLoad);
HookEvent(ME_SYSTEM_MODULEUNLOAD, OnPluginUnload);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoad);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconChange);
HookEvent(ME_OPT_INITIALISE, TTBOptInit);
|