diff options
author | George Hazan <ghazan@miranda.im> | 2017-11-28 13:02:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-11-28 13:02:52 +0300 |
commit | 0759aacd40cb8e2f2de47634a6043d8a1c35dcda (patch) | |
tree | 3d27f39edf931bcecc0fb78df562d493fd521df9 /plugins/Scriver | |
parent | 51e27d7122c871c253b7a183da8ac8720f0f2ea7 (diff) |
crash fix for recursive contact deletion in Scriver
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/src/cmdlist.cpp | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/cmdlist.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/plugins/Scriver/src/cmdlist.cpp b/plugins/Scriver/src/cmdlist.cpp index dbeed95eec..4b8b66da7d 100644 --- a/plugins/Scriver/src/cmdlist.cpp +++ b/plugins/Scriver/src/cmdlist.cpp @@ -85,7 +85,7 @@ TCmdList* tcmdlist_last(TCmdList *list) return nullptr;
}
-void tcmdlist_free(TCmdList *list)
+void tcmdlist_free(TCmdList *&list)
{
TCmdList *n = list, *next;
@@ -95,4 +95,6 @@ void tcmdlist_free(TCmdList *list) mir_free(n);
n = next;
}
+
+ list = nullptr;
}
diff --git a/plugins/Scriver/src/cmdlist.h b/plugins/Scriver/src/cmdlist.h index 249515ed10..9f2b89bb91 100644 --- a/plugins/Scriver/src/cmdlist.h +++ b/plugins/Scriver/src/cmdlist.h @@ -34,6 +34,6 @@ TCmdList* tcmdlist_remove_first(TCmdList *list); TCmdList* tcmdlist_last(TCmdList *list);
int tcmdlist_len(TCmdList *list);
-void tcmdlist_free(TCmdList *list);
+void tcmdlist_free(TCmdList *&list);
#endif
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 6d1bd4afe1..162b22b7de 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -410,9 +410,12 @@ void CSrmmWindow::OnDestroy() DeleteObject(hFont);
db_set_b(m_hContact, SRMM_MODULE, "UseRTL", m_bUseRtl);
- if (m_hContact && (g_dat.flags & SMF_DELTEMP))
+ if (m_hContact && (g_dat.flags & SMF_DELTEMP)) {
+ m_hContact = INVALID_CONTACT_ID; // to prevent recursion
+
if (db_get_b(m_hContact, "CList", "NotOnList", 0))
db_delete_contact(m_hContact);
+ }
SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
if (m_hwndIeview != nullptr) {
|