Sergio Gómez Del Rea =?UTF-8?Q?l=20?=: riched20: Add destroy_para() helper.
Alexandre Julliard
julliard at winehq.org
Thu Nov 29 15:33:01 CST 2018
Module: wine
Branch: master
Commit: 118908d0afff9df23be3102fc8715b7e03267cac
URL: https://source.winehq.org/git/wine.git/?a=commit;h=118908d0afff9df23be3102fc8715b7e03267cac
Author: Sergio Gómez Del Real <sdelreal at codeweavers.com>
Date: Thu Nov 29 08:44:48 2018 -0500
riched20: Add destroy_para() helper.
Signed-off-by: Sergio Gómez Del Real <sdelreal at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/editor.c | 5 ++++-
dlls/riched20/editor.h | 1 +
dlls/riched20/list.c | 6 ------
dlls/riched20/para.c | 11 ++++++++++-
4 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 2571ce9..d79888b 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3164,7 +3164,10 @@ void ME_DestroyEditor(ME_TextEditor *editor)
ME_EmptyUndoStack(editor);
while(p) {
pNext = p->next;
- ME_DestroyDisplayItem(p);
+ if (p->type == diParagraph)
+ destroy_para(editor, p);
+ else
+ ME_DestroyDisplayItem(p);
p = pNext;
}
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index eba6d35..e1a002b 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -77,6 +77,7 @@ ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
+void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN;
/* string.c */
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/list.c b/dlls/riched20/list.c
index ba35a90..23d1a38 100644
--- a/dlls/riched20/list.c
+++ b/dlls/riched20/list.c
@@ -161,12 +161,6 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
{
if (0)
TRACE("type=%s\n", ME_GetDITypeName(item->type));
- if (item->type==diParagraph)
- {
- ME_DestroyString(item->member.para.text);
- para_num_clear( &item->member.para.para_num );
- }
-
if (item->type==diRun)
{
if (item->member.run.reobj)
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index fcd7936..3d86734 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -32,6 +32,15 @@ static ME_DisplayItem *make_para(ME_TextEditor *editor)
return item;
}
+void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
+{
+ assert(item->type == diParagraph);
+
+ ME_DestroyString(item->member.para.text);
+ para_num_clear( &item->member.para.para_num );
+ ME_DestroyDisplayItem(item);
+}
+
void ME_MakeFirstParagraph(ME_TextEditor *editor)
{
ME_Context c;
@@ -682,7 +691,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
tp->member.para.next_para = pNext->member.para.next_para;
pNext->member.para.next_para->member.para.prev_para = tp;
ME_Remove(pNext);
- ME_DestroyDisplayItem(pNext);
+ destroy_para(editor, pNext);
ME_PropagateCharOffset(tp->member.para.next_para, -end_len);
More information about the wine-cvs
mailing list