riched20: Avoid releasing a non-existent interface.
Jactry Zeng
jactry92 at gmail.com
Wed Apr 16 05:51:42 CDT 2014
-------------- next part --------------
From 65353fcf54e403a91816b2b4900367148b2dc059 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <jactry92 at gmail.com>
Date: Wed, 16 Apr 2014 18:28:27 +0800
Subject: riched20: Avoid releasing a non-existent interface.
---
dlls/riched20/richole.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 6f2d579..776cf88 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -129,9 +129,16 @@ IRichEditOle_fnRelease(IRichEditOle *me)
if (!ref)
{
TRACE ("Destroying %p\n", This);
- This->txtSel->reOle = NULL;
- ITextSelection_Release(&This->txtSel->ITextSelection_iface);
- IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
+ if(This->txtSel)
+ {
+ This->txtSel->reOle = NULL;
+ ITextSelection_Release(&This->txtSel->ITextSelection_iface);
+ }
+ if(This->clientSite)
+ {
+ This->clientSite->reOle = NULL;
+ IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
+ }
heap_free(This);
}
return ref;
@@ -197,7 +204,11 @@ static ULONG WINAPI IOleClientSite_fnRelease(IOleClientSite *iface)
IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
+ {
+ if(This->reOle)
+ This->reOle->clientSite = NULL;
heap_free(This);
+ }
return ref;
}
@@ -728,7 +739,11 @@ static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me)
ITextSelectionImpl *This = impl_from_ITextSelection(me);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
+ {
+ if(This->reOle)
+ This->reOle->txtSel = NULL;
heap_free(This);
+ }
return ref;
}
--
1.8.5.2 (Apple Git-48)
More information about the wine-patches
mailing list