summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-15 13:05:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-15 13:05:29 +0300
commit6faf729cee53aa57547705b83e0401b29c642ab2 (patch)
tree26e082c629a93c4b5facc910a89df66664dc450c /plugins
parentc7c2bb6fe1e94010b922eb2dff8bf6a763aa16bb (diff)
Popup+:
- fixes #1359 p.2 (After dynamic unloading and loading again, Popup+ throws an error) - obsolete variable hMainThread removed; - code cleaning; - version bump;
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Popup/src/config.cpp2
-rw-r--r--plugins/Popup/src/config.h1
-rw-r--r--plugins/Popup/src/main.cpp4
-rw-r--r--plugins/Popup/src/popup_thread.cpp3
-rw-r--r--plugins/Popup/src/services.cpp13
-rw-r--r--plugins/Popup/src/version.h2
6 files changed, 10 insertions, 15 deletions
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp
index fc276a1b63..eafca08668 100644
--- a/plugins/Popup/src/config.cpp
+++ b/plugins/Popup/src/config.cpp
@@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ===== General Plugin =====
HINSTANCE hInst;
-HANDLE hMainThread;
-// MNOTIFYLINK *notifyLink; // deprecatet
HANDLE hSemaphore;
BOOL closing = FALSE;
diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h
index 07e9d6d86c..ae2d599e42 100644
--- a/plugins/Popup/src/config.h
+++ b/plugins/Popup/src/config.h
@@ -126,7 +126,6 @@ void LoadOptions();
//===== General Plugin =====
extern HINSTANCE hInst;
-extern HANDLE hMainThread;
extern HANDLE hEventNotify;
extern HANDLE hSemaphore;
extern BOOL closing;
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 7471eddb29..aaff53315c 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -315,8 +315,6 @@ static int OnShutdown(WPARAM, LPARAM)
// Called when the plugin is loaded into Miranda
MIRAPI int Load(void)
{
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
-
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
@@ -438,7 +436,5 @@ MIRAPI int Unload(void)
UnloadActions();
UnloadTreeData();
-
- CloseHandle(hMainThread);
return 0;
}
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp
index 5caede1cf1..508bece260 100644
--- a/plugins/Popup/src/popup_thread.cpp
+++ b/plugins/Popup/src/popup_thread.cpp
@@ -229,7 +229,7 @@ static unsigned __stdcall PopupThread(void *)
wcl.lpszMenuName = nullptr;
wcl.lpszClassName = L"PopupThreadManagerWnd";
wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
- g_wndClass.cPopupThreadManagerWnd = RegisterClassEx(&wcl);
+ g_wndClass.cPopupThreadManagerWnd = RegisterClassExW(&wcl);
err = GetLastError();
if (!g_wndClass.cPopupThreadManagerWnd) {
wchar_t msg[1024];
@@ -247,6 +247,7 @@ static unsigned __stdcall PopupThread(void *)
}
DestroyWindow(gHwndManager); gHwndManager = nullptr;
+ UnregisterClassW(wcl.lpszClassName, hInst);
return 0;
}
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index d545d5ff9e..fab7339724 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -330,12 +330,13 @@ struct SafeUnhookEventParam
HANDLE hEvent;
};
-static void CALLBACK SafeUnhookEventFunc(ULONG_PTR dwParam)
+static void CALLBACK SafeUnhookEventFunc(void *param)
{
- UnhookEvent(((SafeUnhookEventParam *)dwParam)->hEvent);
- PostMessage(((SafeUnhookEventParam *)dwParam)->hwndPopup, UM_POPUPUNHOOKCOMPLETE, 0,
- (LPARAM)((SafeUnhookEventParam *)dwParam)->hEvent);
- delete (SafeUnhookEventParam *)dwParam;
+ SafeUnhookEventParam *p = (SafeUnhookEventParam*)param;
+
+ UnhookEvent(p->hEvent);
+ PostMessage(p->hwndPopup, UM_POPUPUNHOOKCOMPLETE, 0, (LPARAM)p->hEvent);
+ delete p;
}
INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
@@ -343,7 +344,7 @@ INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
SafeUnhookEventParam *param = new SafeUnhookEventParam;
param->hwndPopup = (HWND)wParam;
param->hEvent = (HANDLE)lParam;
- QueueUserAPC(SafeUnhookEventFunc, hMainThread, (ULONG_PTR)param);
+ CallFunctionAsync(SafeUnhookEventFunc, param);
return 0;
}
diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h
index cbbaf99aa8..d8239c112b 100644
--- a/plugins/Popup/src/version.h
+++ b/plugins/Popup/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 12
+#define __BUILD_NUM 14
#include <stdver.h>