From a124117f40c1c69f68959244bd2f390a617b0fd0 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 21 Mar 2019 14:40:44 +0100 Subject: [PATCH] mshtml: Remove selection and range objects from document list when detaching. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/selection.c | 5 +++-- dlls/mshtml/txtrange.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index dfbb386b938..da8fbfa2e23 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -364,9 +364,10 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect void detach_selection(HTMLDocumentNode *This) { - HTMLSelectionObject *iter; + HTMLSelectionObject *iter, *next; - LIST_FOR_EACH_ENTRY(iter, &This->selection_list, HTMLSelectionObject, entry) { + LIST_FOR_EACH_ENTRY_SAFE(iter, next, &This->selection_list, HTMLSelectionObject, entry) { iter->doc = NULL; + list_remove(&iter->entry); } } diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c index bfabbf40e74..b377fad4b6b 100644 --- a/dlls/mshtml/txtrange.c +++ b/dlls/mshtml/txtrange.c @@ -1760,9 +1760,10 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx void detach_ranges(HTMLDocumentNode *This) { - HTMLTxtRange *iter; + HTMLTxtRange *iter, *next; - LIST_FOR_EACH_ENTRY(iter, &This->range_list, HTMLTxtRange, entry) { + LIST_FOR_EACH_ENTRY_SAFE(iter, next, &This->range_list, HTMLTxtRange, entry) { iter->doc = NULL; + list_remove(&iter->entry); } }