summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-12-09 11:19:36 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-12-09 11:19:36 +0000
commit5aab2f53c4b6062a125cbe5242992efad0ff68ef (patch)
tree71f93fe514c77303e0fe5a5d568a574fae938707
parentf8f8072f5195d00bdd8967f291c680643659d919 (diff)
memory leaks and dc font reset (thx George)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@70 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r--tipper/popwin.cpp5
-rw-r--r--tipper/subst.cpp3
-rw-r--r--tipper/tipper.mdsp2
-rw-r--r--tipper/version.h2
4 files changed, 9 insertions, 3 deletions
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp
index bddb175..d0f8055 100644
--- a/tipper/popwin.cpp
+++ b/tipper/popwin.cpp
@@ -310,6 +310,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
HDC hdc = ps.hdc;
GetClientRect(hwnd, &r);
r2 = r;
+ HFONT hOldFont = (HFONT)GetCurrentObject(hdc,OBJ_FONT);
// text background
//SetBkColor(ps.hdc, options.bg_col);
@@ -458,6 +459,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
+ SelectObject(hdc, hOldFont);
EndPaint(hwnd, &ps);
//}
}
@@ -528,6 +530,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
DBWriteContactSettingTString(pwd->hContact, MODULE, "TempStatusMsg", (TCHAR*)lParam);
SendMessage(hwnd, PUM_REFRESH_VALUES, 0, 0);
}
+ if(lParam) free((void *)lParam);
}
return TRUE;
case PUM_SETAVATAR:
@@ -605,6 +608,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
r.top = r.left = 0;
r.right = options.win_width;
int width = options.padding;
+ HFONT hOldFont = (HFONT)GetCurrentObject(hdc,OBJ_FONT);
// titlebar height
if(!pwd->text_tip && pwd->swzTitle && options.title_layout != PTL_NOTITLE) {
@@ -700,6 +704,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
+ SelectObject(hdc, hOldFont);
ReleaseDC(hwnd, hdc);
int height = max(pwd->tb_height + pwd->text_height + options.padding, pwd->av_height);
diff --git a/tipper/subst.cpp b/tipper/subst.cpp
index f7e7f5d..aac9e8f 100644
--- a/tipper/subst.cpp
+++ b/tipper/subst.cpp
@@ -121,7 +121,7 @@ TCHAR *GetLastMessageText(HANDLE hContact) {
}
if(hDbEvent) {
- dbei.pBlob = (BYTE *)malloc(dbei.cbBlob);
+ dbei.pBlob = (BYTE *)alloca(dbei.cbBlob);
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
if(dbei.cbBlob == 0 || dbei.pBlob == 0) return 0;
@@ -194,6 +194,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *raw_spec, TCHAR *buff, int bufflen)
TCHAR *msg = GetLastMessageText(hContact);
if(msg) {
_tcsncpy(buff, msg, bufflen);
+ free(msg);
return true;
}
} else if (!_tcscmp(raw_spec, _T("meta_subname"))) {
diff --git a/tipper/tipper.mdsp b/tipper/tipper.mdsp
index cab97b4..6ee871f 100644
--- a/tipper/tipper.mdsp
+++ b/tipper/tipper.mdsp
@@ -104,6 +104,6 @@ extraResourceOptions=
1=resource.rc
[Other]
[History]
-version.h,750
tipper.cpp,3285
+version.h,750
message_pump.cpp,4381
diff --git a/tipper/version.h b/tipper/version.h
index b49bbe2..657952c 100644
--- a/tipper/version.h
+++ b/tipper/version.h
@@ -4,7 +4,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 3
#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM