From 1a0dc87d73d7a71028ac335be0d67433f410bab1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 2 Aug 2022 22:31:54 +0300 Subject: code to prevent UserInfo hooks from being destroyed --- plugins/UserInfoEx/src/dlg_propsheet.cpp | 2 +- src/core/stduserinfo/src/userinfo.cpp | 1 + src/mir_app/src/miranda.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index c93136e8fb..d541b37281 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -1337,6 +1337,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar void DlgContactInfoLoadModule() { + // this event is already created inside the core, don't destroy it g_hDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE); CreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDialog); @@ -1358,5 +1359,4 @@ void DlgContactInfoLoadModule() void DlgContactInfoUnLoadModule() { WindowList_Destroy(g_hWindowList); - DestroyHookableEvent(g_hDetailsInitEvent); } diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 6227348757..d1deb514b9 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -576,6 +576,7 @@ int LoadUserInfoModule(void) CreateServiceFunction("UserInfo/AddPage", AddDetailsPage); CreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDetailsDialogCommand); + // this event is already created inside the core, don't destroy it hDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE); HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded); diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 4f6e7b1beb..7628da2e66 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -336,5 +336,8 @@ int LoadSystemModule(void) hModulesLoadedEvent = CreateHookableEvent(ME_SYSTEM_MODULESLOADED); hOkToExitEvent = CreateHookableEvent(ME_SYSTEM_OKTOEXIT); hOptionsInitEvent = CreateHookableEvent(ME_OPT_INITIALISE); + + // this event is created inside the core not to lose its hooks when MIID_UIUSERINFO plugin reloads + CreateHookableEvent(ME_USERINFO_INITIALISE); return 0; } -- cgit v1.2.3