From bcd9393446d6c803335a05490c74be0e5fe5fd09 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 15 Apr 2019 18:35:01 +0300 Subject: fixes #1660 (Notes & Reminders: attempt to edit a reminder creates the duplicate item that crashes Miranda on deletion) --- plugins/NotesAndReminders/src/notes.cpp | 8 ++------ plugins/NotesAndReminders/src/reminders.cpp | 4 ++-- plugins/NotesAndReminders/src/version.h | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 60f409b95f..22e890ba81 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -29,8 +29,6 @@ #define NOTIFY_LIST() if (ListNotesVisible) PostMessage(LV,WM_RELOAD,0,0) -#define PENLINK ENLINK * - #define NOTE_WND_CLASS L"MIM_StickyNote" #define IDM_COLORPRESET_BG 41000 @@ -738,12 +736,10 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA case WM_NOTIFY: if (LOWORD(wParam) == 1) { - char *Buff; - PENLINK PEnLnk = (PENLINK)lParam; - + ENLINK *PEnLnk = (ENLINK*)lParam; if (PEnLnk->msg == WM_LBUTTONDOWN) { SendDlgItemMessage(hdlg, 1, EM_EXSETSEL, 0, (LPARAM)&(PEnLnk->chrg)); - Buff = (char*)malloc(PEnLnk->chrg.cpMax - PEnLnk->chrg.cpMin + 1); + char* Buff = (char*)malloc(PEnLnk->chrg.cpMax - PEnLnk->chrg.cpMin + 1); SendDlgItemMessage(hdlg, 1, EM_GETSELTEXT, 0, (LPARAM)Buff); if ((GetAsyncKeyState(VK_CONTROL) >> 15) != 0) ShellExecuteA(hdlg, "open", "iexplore", Buff, "", SW_SHOWNORMAL); diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 920ac3142e..547dc262af 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -1253,6 +1253,7 @@ public: void onClick_RemindAgain(CCtrlButton*) { + arReminders.remove(m_pReminder); if (chkAfter.GetState()) { // delta time SYSTEMTIME tm; @@ -1320,7 +1321,6 @@ public: m_pReminder->handle = nullptr; // re-insert tree item sorted - arReminders.remove(m_pReminder); arReminders.insert(m_pReminder); m_pReminder = nullptr; // prevent reminder from being deleted; Close(); @@ -1533,6 +1533,7 @@ public: } else { // update existing reminder + arReminders.remove(m_pReminder); SystemTimeToFileTime(&Date, (FILETIME*)&m_pReminder->When); m_pReminder->szText = ptrA(edtText.GetTextA()); @@ -1541,7 +1542,6 @@ public: m_pReminder->RepeatSound = m_pReminder->SoundSel < 0 ? 0 : (UINT)RepeatSound; // re-insert tree item sorted - arReminders.remove(m_pReminder); arReminders.insert(m_pReminder); m_pReminder->bVisible = false; diff --git a/plugins/NotesAndReminders/src/version.h b/plugins/NotesAndReminders/src/version.h index c7f03daa18..cc46754d46 100644 --- a/plugins/NotesAndReminders/src/version.h +++ b/plugins/NotesAndReminders/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 2 #define __RELEASE_NUM 0 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include -- cgit v1.2.3