summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-04 19:57:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-04 19:57:20 +0000
commit011c86b22aa67f25d751f731501eaaec9600f44c (patch)
treec48c84bc91dcd97975a4996d5cffee41ff873fea /plugins/SmileyAdd/src
parenta9e2b96e8d4664fddea569f0c233bc0b028555f1 (diff)
fix for the smileys cleanup procedure
git-svn-id: http://svn.miranda-ng.org/main/trunk@3887 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd/src')
-rw-r--r--plugins/SmileyAdd/src/AniSmileyObject.cpp6
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp4
-rw-r--r--plugins/SmileyAdd/src/general.h4
-rw-r--r--plugins/SmileyAdd/src/richcall.cpp68
4 files changed, 37 insertions, 45 deletions
diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp
index 42a63d3549..0412aa5cd8 100644
--- a/plugins/SmileyAdd/src/AniSmileyObject.cpp
+++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp
@@ -440,11 +440,13 @@ static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
void DestroyAniSmileys(void)
{
- if (timerId && (timerId+1))
- {
+ if (timerId && (timerId+1)) {
KillTimer(NULL, timerId);
timerId = 0;
}
+
+ for (int i=0; i < regAniSmileys.getCount(); i++)
+ delete regAniSmileys[i];
regAniSmileys.destroy();
}
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 9184bf10ab..656c7130cf 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -506,8 +506,8 @@ static int MsgDlgHook(WPARAM, LPARAM lParam)
case MSG_WINDOW_EVT_CLOSE:
if (wndEvtData->cbSize >= sizeof(MessageWindowEventData) && wndEvtData->hwndLog)
{
- CloseRichCallback(wndEvtData->hwndLog, true);
- CloseRichOwnerCallback(wndEvtData->hwndWindow, true);
+ CloseRichCallback(wndEvtData->hwndLog);
+ CloseRichOwnerCallback(wndEvtData->hwndWindow);
}
break;
}
diff --git a/plugins/SmileyAdd/src/general.h b/plugins/SmileyAdd/src/general.h
index 8cc13c5619..93d9a2e7d6 100644
--- a/plugins/SmileyAdd/src/general.h
+++ b/plugins/SmileyAdd/src/general.h
@@ -216,8 +216,8 @@ void DestroyGdiPlus(void);
void ReportError(const TCHAR* errmsg);
HICON GetDefaultIcon(bool copy = true);
-void CloseRichCallback(HWND hwnd, bool force);
-void CloseRichOwnerCallback(HWND hwnd, bool force);
+void CloseRichCallback(HWND hwnd);
+void CloseRichOwnerCallback(HWND hwnd);
bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew);
void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog);
void ProcessAllInputAreas(bool restoreText);
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp
index 463276baf4..23c1383f9f 100644
--- a/plugins/SmileyAdd/src/richcall.cpp
+++ b/plugins/SmileyAdd/src/richcall.cpp
@@ -217,7 +217,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP
switch(uMsg) {
case WM_DESTROY:
- CloseRichCallback(hwnd, false);
+ CloseRichCallback(hwnd);
break;
case WM_COPY:
@@ -261,10 +261,6 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP
LRESULT result = mir_callNextSubclass(hwnd, RichEditSubclass, uMsg, wParam, lParam);
switch(uMsg) {
- case WM_DESTROY:
- CloseRichCallback(hwnd, true);
- break;
-
case WM_MOUSEMOVE:
SetTooltip(LOWORD(lParam), HIWORD(lParam), hwnd, rdt);
break;
@@ -348,16 +344,14 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP
return result;
}
-void CloseRichCallback(HWND hwnd, bool force)
+void CloseRichCallback(HWND hwnd)
{
int ind = g_RichEditList.getIndex((RichEditData*)&hwnd);
if ( ind != -1 ) {
RichEditData* rdt = g_RichEditList[ind];
- if (force) {
- if (rdt->hToolTip) DestroyWindow(rdt->hToolTip);
- delete rdt;
- g_RichEditList.remove(ind);
- }
+ if (rdt->hToolTip) DestroyWindow(rdt->hToolTip);
+ delete rdt;
+ g_RichEditList.remove(ind);
}
}
@@ -400,6 +394,17 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara
return 0;
switch(uMsg) {
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
+ RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
+ rdt->dontReplace = true;
+ CHARRANGE sel = allsel;
+ ReplaceSmileysWithText(rdt->hwnd, sel, false);
+ }
+ }
+ break;
+
case WM_DESTROY:
if ( !Miranda_Terminated()) {
CHARRANGE sel = allsel;
@@ -408,36 +413,21 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara
if (rdto->hwndLog)
ReplaceSmileysWithText(rdto->hwndLog, sel, false);
}
- else {
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
- CHARRANGE sel = allsel;
- rdt->dontReplace = true;
- ReplaceSmileysWithText(rdt->hwnd, sel, false);
- }
- }
- CloseRichOwnerCallback(hwnd, false);
- break;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
- rdt->dontReplace = true;
- CHARRANGE sel = allsel;
- ReplaceSmileysWithText(rdt->hwnd, sel, false);
- }
+ RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
+ CHARRANGE sel = allsel;
+ rdt->dontReplace = true;
+ ReplaceSmileysWithText(rdt->hwnd, sel, false);
}
+
+ CloseRichOwnerCallback(hwnd);
break;
}
LRESULT result = mir_callNextSubclass(hwnd, RichEditOwnerSubclass, uMsg, wParam, lParam);
switch(uMsg) {
- case WM_DESTROY:
- CloseRichOwnerCallback(hwnd, true);
- break;
-
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
@@ -452,16 +442,16 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara
return result;
}
-void CloseRichOwnerCallback(HWND hwnd, bool force)
+void CloseRichOwnerCallback(HWND hwnd)
{
int ind = g_RichEditOwnerList.getIndex((RichEditOwnerData*)&hwnd);
if (ind == -1)
return;
RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
- if (rdto && force) {
- CloseRichCallback(rdto->hwndInput, true);
- CloseRichCallback(rdto->hwndLog, true);
+ if (rdto) {
+ CloseRichCallback(rdto->hwndInput);
+ CloseRichCallback(rdto->hwndLog);
delete rdto;
g_RichEditOwnerList.remove(ind);
@@ -504,10 +494,10 @@ void RichEditData_Destroy(void)
{
int i;
for (i=g_RichEditList.getCount(); i--; )
- CloseRichCallback(g_RichEditList[i]->hwnd, true);
+ CloseRichCallback(g_RichEditList[i]->hwnd);
g_RichEditList.destroy();
for (i=g_RichEditOwnerList.getCount(); i--; )
- CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd, true);
+ CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd);
g_RichEditOwnerList.destroy();
}