Commit 118908d0 authored by Sergio Gómez Del Real's avatar Sergio Gómez Del Real Committed by Alexandre Julliard

riched20: Add destroy_para() helper.

parent 4e633f92
......@@ -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;
}
......
......@@ -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;
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment