summaryrefslogtreecommitdiff
path: root/plugins/YAPP/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-01 18:16:04 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-01 18:16:04 +0000
commitc97a1472f85733e0cf4f3423af6647ff2fa00520 (patch)
tree61a37070d96d8ea98abacee9a58418ea2915d6e0 /plugins/YAPP/src
parent686046823acca19e390051ca1b3decf7d001d117 (diff)
crash fix for YAPP (on exit)
git-svn-id: http://svn.miranda-ng.org/main/trunk@7023 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAPP/src')
-rw-r--r--plugins/YAPP/src/common.h7
-rw-r--r--plugins/YAPP/src/message_pump.cpp2
-rw-r--r--plugins/YAPP/src/options.cpp3
-rw-r--r--plugins/YAPP/src/services.cpp22
-rw-r--r--plugins/YAPP/src/yapp.cpp2
5 files changed, 28 insertions, 8 deletions
diff --git a/plugins/YAPP/src/common.h b/plugins/YAPP/src/common.h
index 209c441358..b906cdcf48 100644
--- a/plugins/YAPP/src/common.h
+++ b/plugins/YAPP/src/common.h
@@ -63,10 +63,11 @@
#define MODULE "YAPP"
-extern HMODULE hInst;
+extern HMODULE hInst;
+extern bool bShutdown;
-extern HFONT hFontFirstLine, hFontSecondLine, hFontTime;
-extern COLORREF colFirstLine, colSecondLine, colBg, colTime, colBorder, colSidebar, colTitleUnderline;
+extern HFONT hFontFirstLine, hFontSecondLine, hFontTime;
+extern COLORREF colFirstLine, colSecondLine, colBg, colTime, colBorder, colSidebar, colTitleUnderline;
extern MNOTIFYLINK *notifyLink;
diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp
index 73dd3fbf1b..3e2ae6a76f 100644
--- a/plugins/YAPP/src/message_pump.cpp
+++ b/plugins/YAPP/src/message_pump.cpp
@@ -15,7 +15,7 @@ unsigned __stdcall MessagePumpThread(void* param)
SetEvent((HANDLE)param);
MSG hwndMsg = { 0 };
- while(GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) {
+ while (GetMessage(&hwndMsg, 0, 0, 0) > 0 && !bShutdown) {
if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) {
switch(hwndMsg.message) {
case MUM_CREATEPOPUP:
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp
index 25685a25d6..accbc0f630 100644
--- a/plugins/YAPP/src/options.cpp
+++ b/plugins/YAPP/src/options.cpp
@@ -81,7 +81,8 @@ void SaveOptions()
db_set_dw(0, MODULE, "AvatarPadding", options.av_padding);
}
-void ShowExamplePopups() {
+void ShowExamplePopups()
+{
PopupData pd = {sizeof(PopupData)};
pd.hIcon = hPopupIcon;
pd.flags = PDF_TCHAR;
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index 7d374a7dde..2dd4d83332 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -42,6 +42,9 @@ void StripBBCodesInPlace(wchar_t *text)
static INT_PTR CreatePopup(WPARAM wParam, LPARAM lParam)
{
+ if (bShutdown)
+ return -1;
+
POPUPDATA *pd_in = (POPUPDATA *)wParam;
if ( NotifyEventHooks(hEventNotify, (WPARAM)pd_in->lchContact, (LPARAM)pd_in->PluginWindowProc))
return 0;
@@ -80,6 +83,9 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM lParam)
static INT_PTR CreatePopupW(WPARAM wParam, LPARAM lParam)
{
+ if (bShutdown)
+ return -1;
+
POPUPDATAW *pd_in = (POPUPDATAW *)wParam;
if ( NotifyEventHooks(hEventNotify, (WPARAM)pd_in->lchContact, (LPARAM)pd_in->PluginWindowProc))
return 0;
@@ -207,7 +213,8 @@ void UpdateMenu()
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, isEnabled ? TTBST_PUSHED : TTBST_RELEASED);
}
-INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) {
+INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam)
+{
switch(wParam) {
case PUQS_ENABLEPOPUPS:
{
@@ -244,6 +251,9 @@ static INT_PTR TogglePopups(WPARAM wParam, LPARAM lParam)
static INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam)
{
+ if (bShutdown)
+ return -1;
+
HWND hwndPop = (HWND)wParam;
POPUPDATAW *pd_in = (POPUPDATAW *)lParam;
@@ -280,7 +290,10 @@ static INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam)
static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam)
{
- if ( db_get_b(0, MODULE, "Enabled", 1)) {
+ if (bShutdown)
+ return -1;
+
+ if (db_get_b(0, MODULE, "Enabled", 1)) {
POPUPDATAT pd = {0};
_tcscpy(pd.lptzContactName, lParam == SM_WARNING ? _T("Warning") : _T("Notification"));
pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
@@ -292,7 +305,10 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam)
static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam)
{
- if ( db_get_b(0, MODULE, "Enabled", 1)) {
+ if (bShutdown)
+ return -1;
+
+ if (db_get_b(0, MODULE, "Enabled", 1)) {
POPUPDATAW pd = {0};
wcscpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp
index 0b7acda833..4b8ffe32f8 100644
--- a/plugins/YAPP/src/yapp.cpp
+++ b/plugins/YAPP/src/yapp.cpp
@@ -4,6 +4,7 @@
#include "common.h"
HMODULE hInst = 0;
+bool bShutdown = false;
MNOTIFYLINK *notifyLink = 0;
@@ -225,6 +226,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
int PreShutdown(WPARAM wParam, LPARAM lParam)
{
+ bShutdown = true;
DeinitMessagePump();
DeinitNotify();
return 0;