riched20-IText_Interface: Avoid additional linked lists for font/para interfaces.

This commit is contained in:
Sebastian Lackner 2015-05-20 07:35:12 +02:00
parent 349ba2df2a
commit f09433417e
6 changed files with 356 additions and 552 deletions

View File

@ -4612,9 +4612,8 @@ if test "$enable_riched20_IText_Interface" -eq 1; then
patch_apply riched20-IText_Interface/0007-riched20-Implement-ITextRange-IsEqual.patch
patch_apply riched20-IText_Interface/0008-riched20-Implement-ITextRange-GetStoryLength.patch
patch_apply riched20-IText_Interface/0009-riched20-Implement-ITextSelection-GetStoryLength.patch
patch_apply riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch
patch_apply riched20-IText_Interface/0011-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch
patch_apply riched20-IText_Interface/0012-riched20-Implement-ITextSelection_fnGetDuplicate.patch
patch_apply riched20-IText_Interface/0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch
patch_apply riched20-IText_Interface/0011-riched20-Implement-ITextSelection_fnGetDuplicate.patch
(
echo '+ { "Jactry Zeng", "riched20: Implement IText{Selection, Range}::Set{Start, End}.", 1 },';
echo '+ { "Jactry Zeng", "riched20: Stub for ITextFont interface and implement ITextRange::GetFont and ITextSelection::GetFont.", 1 },';
@ -4625,7 +4624,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then
echo '+ { "Jactry Zeng", "riched20: Implement ITextRange::IsEqual.", 1 },';
echo '+ { "Jactry Zeng", "riched20: Implement ITextRange::GetStoryLength.", 1 },';
echo '+ { "Jactry Zeng", "riched20: Implement ITextSelection::GetStoryLength.", 1 },';
echo '+ { "Sebastian Lackner", "riched20: Fix invalid memory access when parent object was destroyed earlier than child object.", 1 },';
echo '+ { "Sebastian Lackner", "riched20: Silence repeated FIXMEs triggered by Adobe Reader.", 1 },';
echo '+ { "Sebastian Lackner", "riched20: Implement ITextSelection_fnGetDuplicate.", 1 },';
) >> "$patchlist"

View File

@ -1,49 +0,0 @@
From 44c16f1f02bf269a595b914bcc55a37184fc1fa4 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 13 Sep 2014 17:21:31 +0200
Subject: riched20: Fix invalid memory access when parent object was destroyed
earlier than child object.
---
dlls/riched20/richole.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index d3ed501..7a07a84 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -1618,10 +1618,13 @@ static ULONG WINAPI TextFont_Release(ITextFont *iface)
ITextRange_Release(&This->txtRge->ITextRange_iface);
else
ITextSelection_Release(&This->txtSel->ITextSelection_iface);
- This->reOle = NULL;
This->txtRge = NULL;
This->txtSel = NULL;
- list_remove(&This->entry);
+ if (This->reOle)
+ {
+ list_remove(&This->entry);
+ This->reOle = NULL;
+ }
heap_free(This);
}
@@ -2441,10 +2444,13 @@ static ULONG WINAPI TextPara_Release(ITextPara *iface)
ITextRange_Release(&This->txtRge->ITextRange_iface);
else
ITextSelection_Release(&This->txtSel->ITextSelection_iface);
- This->reOle = NULL;
This->txtRge = NULL;
This->txtSel = NULL;
- list_remove(&This->entry);
+ if (This->reOle)
+ {
+ list_remove(&This->entry);
+ This->reOle = NULL;
+ }
heap_free(This);
}
--
2.4.0

View File

@ -1,4 +1,4 @@
From e0ae36a5cdcabb900a2e12a701990f4d0fcc7f7b Mon Sep 17 00:00:00 2001
From 85ae581146a9791fd45006b273c19f822f1ccf4f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 1 Nov 2014 22:51:34 +0100
Subject: riched20: Silence repeated FIXMEs triggered by Adobe Reader.
@ -9,10 +9,10 @@ Adobe Reader calls these functions very often while scrolling through a document
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index a2cdcf4..cb12e80 100644
index b9213f6..6676d9a 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -300,6 +300,14 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R
@@ -294,6 +294,14 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R
IUnknown_AddRef((IUnknown *)*ppvObj);
return S_OK;
}
@ -27,17 +27,24 @@ index a2cdcf4..cb12e80 100644
FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid));
return E_NOINTERFACE;
@@ -1961,7 +1969,8 @@ static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value)
return CO_E_RELEASED;
if (!This->txtRge)
{
- FIXME("not implemented\n");
+ static int once;
+ if (!once++) FIXME("not implemented\n");
return E_NOTIMPL;
}
@@ -1927,6 +1935,7 @@ static HRESULT WINAPI TextFont_SetBackColor(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
+ static int once;
TRACE("(%p)->(%p)\n", This, value);
@@ -2004,7 +2013,9 @@ static HRESULT WINAPI TextFont_SetEmboss(ITextFont *iface, LONG value)
if (This->range)
@@ -1940,7 +1949,7 @@ static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value)
if (!font_get_reole(This))
return CO_E_RELEASED;
- FIXME("not implemented\n");
+ if (!once++) FIXME("not implemented\n");
return E_NOTIMPL;
}
@@ -1980,7 +1989,9 @@ static HRESULT WINAPI TextFont_SetEmboss(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetForeColor(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -48,17 +55,24 @@ index a2cdcf4..cb12e80 100644
if (!value)
return E_INVALIDARG;
@@ -2081,7 +2092,8 @@ static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value)
return CO_E_RELEASED;
if (!This->txtRge)
{
- FIXME("not implemented\n");
+ static int once;
+ if (!once++) FIXME("not implemented\n");
return E_NOTIMPL;
}
@@ -2052,6 +2063,7 @@ static HRESULT WINAPI TextFont_SetEngrave(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
+ static int once;
TRACE("(%p)->(%p)\n", This, value);
@@ -2124,7 +2136,9 @@ static HRESULT WINAPI TextFont_SetKerning(ITextFont *iface, FLOAT value)
if (This->range)
@@ -2065,7 +2077,7 @@ static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value)
if (!font_get_reole(This))
return CO_E_RELEASED;
- FIXME("not implemented\n");
+ if (!once++) FIXME("not implemented\n");
return E_NOTIMPL;
}
@@ -2105,7 +2117,9 @@ static HRESULT WINAPI TextFont_SetKerning(ITextFont *iface, FLOAT value)
static HRESULT WINAPI TextFont_GetLanguageID(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -67,9 +81,9 @@ index a2cdcf4..cb12e80 100644
+
+ if (!once++) FIXME("(%p)->(%p): stub\n", This, value);
if (!This->reOle)
if (!font_get_reole(This))
return CO_E_RELEASED;
@@ -2261,7 +2275,9 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value)
@@ -2245,7 +2259,9 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetSize(ITextFont *iface, FLOAT *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -80,7 +94,7 @@ index a2cdcf4..cb12e80 100644
if (!value)
return E_INVALIDARG;
@@ -2330,7 +2346,9 @@ static HRESULT WINAPI TextFont_SetSpacing(ITextFont *iface, FLOAT value)
@@ -2317,7 +2333,9 @@ static HRESULT WINAPI TextFont_SetSpacing(ITextFont *iface, FLOAT value)
static HRESULT WINAPI TextFont_GetStrikeThrough(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -91,7 +105,7 @@ index a2cdcf4..cb12e80 100644
if (!value)
return E_INVALIDARG;
@@ -2355,7 +2373,9 @@ static HRESULT WINAPI TextFont_SetStrikeThrough(ITextFont *iface, LONG value)
@@ -2345,7 +2363,9 @@ static HRESULT WINAPI TextFont_SetStrikeThrough(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetSubscript(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -101,8 +115,8 @@ index a2cdcf4..cb12e80 100644
+ if (!once++) FIXME("(%p)->(%p): stub\n", This, value);
if (!value)
return E_INVALIDARG;
@@ -2405,7 +2425,9 @@ static HRESULT WINAPI TextFont_SetSuperscript(ITextFont *iface, LONG value)
return E_INVALIDARG;
@@ -2401,7 +2421,9 @@ static HRESULT WINAPI TextFont_SetSuperscript(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetUnderline(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -113,7 +127,7 @@ index a2cdcf4..cb12e80 100644
if (!value)
return E_INVALIDARG;
@@ -2430,7 +2452,9 @@ static HRESULT WINAPI TextFont_SetUnderline(ITextFont *iface, LONG value)
@@ -2429,7 +2451,9 @@ static HRESULT WINAPI TextFont_SetUnderline(ITextFont *iface, LONG value)
static HRESULT WINAPI TextFont_GetWeight(ITextFont *iface, LONG *value)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
@ -122,9 +136,9 @@ index a2cdcf4..cb12e80 100644
+
+ if (!once++) FIXME("(%p)->(%p): stub\n", This, value);
if (!This->reOle)
if (!font_get_reole(This))
return CO_E_RELEASED;
@@ -2721,7 +2745,9 @@ static HRESULT WINAPI TextPara_SetStyle(ITextPara *iface, LONG value)
@@ -2723,7 +2747,9 @@ static HRESULT WINAPI TextPara_SetStyle(ITextPara *iface, LONG value)
static HRESULT WINAPI TextPara_GetAlignment(ITextPara *iface, LONG *value)
{
ITextParaImpl *This = impl_from_ITextPara(iface);
@ -133,7 +147,7 @@ index a2cdcf4..cb12e80 100644
+
+ if (!once++) FIXME("(%p)->(%p)\n", This, value);
if (!This->reOle)
if (!para_get_reole(This))
return CO_E_RELEASED;
--
2.4.0

View File

@ -1,4 +1,4 @@
From f5476c2bce17468ae3ca3e24248e76c8ca7a4fb9 Mon Sep 17 00:00:00 2001
From acafb0f9fc1775ba95c3f5dfba08c15fd6678904 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 1 Nov 2014 23:07:09 +0100
Subject: riched20: Implement ITextSelection_fnGetDuplicate.
@ -9,10 +9,10 @@ Fixes a crash with Adobe Reader when entering a page number.
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 9de460f..84c8be4 100644
index 6676d9a..a7eb1d9 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -3178,11 +3178,17 @@ static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
@@ -3681,11 +3681,17 @@ static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRange **ppRange)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
@ -33,5 +33,5 @@ index 9de460f..84c8be4 100644
static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITextRange **ppRange)
--
2.1.2
2.4.0