diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-02 13:04:44 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-02 13:04:44 +0000 |
commit | b5851e7766575c7ec831ff0f420645316f24a25d (patch) | |
tree | 128b3c69b4812b5d9679cce2e2808bb939cee696 /plugins | |
parent | 685181daebe6151915b363adc1dd9f4bda1af919 (diff) |
crash fix when deleting notes (by $ergi0) (fixed #165)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2915 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NotesAndReminders/src/notes.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index a5c79ca142..f249a269fe 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -174,11 +174,9 @@ static void InitStickyNoteLogFont(STICKYNOTEFONT *pCustomFont, LOGFONT *lf) {
if (!pCustomFont->size)
{
- HDC hdc;
-
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
lf->lfHeight = 10;
- hdc = GetDC(0);
+ HDC hdc = GetDC(0);
lf->lfHeight = -MulDiv(lf->lfHeight,GetDeviceCaps(hdc, LOGPIXELSY), 72);
ReleaseDC(0, hdc);
}
@@ -705,7 +703,8 @@ void OnDeleteNote(HWND hdlg, STICKYNOTE *SN) {
if (MessageBox(hdlg, TranslateT("Are you sure you want to delete this note?"), TranslateT(SECTIONNAME), MB_OKCANCEL) == IDOK)
{
- DestroyWindow(hdlg);
+ if (SN->SNHwnd)
+ DestroyWindow(SN->SNHwnd);
TreeDelete(&g_Stickies,SN);
SAFE_FREE((void**)&SN->data);
if (SN->pCustomFont)
@@ -715,6 +714,7 @@ void OnDeleteNote(HWND hdlg, STICKYNOTE *SN) }
SAFE_FREE((void**)&SN);
JustSaveNotes();
+ NOTIFY_LIST();
}
}
@@ -723,13 +723,11 @@ void DeleteNotes(void) PurgeNotes();
WriteSettingInt(0, MODULENAME, "NotesData", 0);
PurgeNotesTree();
+ NOTIFY_LIST();
}
void ShowHideNotes(void)
{
- TREEELEMENT *TTE;
- int bShow;
- UINT nHideCount, nVisCount;
BOOL Visible;
if (!g_Stickies)
@@ -738,8 +736,8 @@ void ShowHideNotes(void) // if some notes are hidden but others visible then first make all visible
// only toggle vis state if all are hidden or all are visible
- nHideCount = nVisCount = 0;
- TTE = g_Stickies;
+ UINT nHideCount = 0, nVisCount = 0;
+ TREEELEMENT *TTE = g_Stickies;
while (TTE)
{
if (((STICKYNOTE*)TTE->ptrdata)->Visible)
@@ -757,7 +755,7 @@ void ShowHideNotes(void) else
Visible = TRUE;
- bShow = Visible ? SW_SHOWNA : SW_HIDE;
+ int bShow = Visible ? SW_SHOWNA : SW_HIDE;
TTE = g_Stickies;
while (TTE)
|