Huw Davies : ole32: Factor out the code to release the delegate interfaces.

Alexandre Julliard julliard at winehq.org
Tue Nov 25 07:21:38 CST 2008


Module: wine
Branch: master
Commit: 8730bf66c9671ec0095d5108e9a507183dbc3fdc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8730bf66c9671ec0095d5108e9a507183dbc3fdc

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Nov 24 15:42:22 2008 +0000

ole32: Factor out the code to release the delegate interfaces.

---

 dlls/ole32/defaulthandler.c |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c
index 6844ee8..ae36201 100644
--- a/dlls/ole32/defaulthandler.c
+++ b/dlls/ole32/defaulthandler.c
@@ -420,6 +420,25 @@ static HRESULT WINAPI DefaultHandler_SetHostNames(
   return S_OK;
 }
 
+static void release_delegates(DefaultHandler *This)
+{
+    if (This->pDataDelegate)
+    {
+        IDataObject_Release(This->pDataDelegate);
+        This->pDataDelegate = NULL;
+    }
+    if (This->pPSDelegate)
+    {
+        IPersistStorage_Release(This->pPSDelegate);
+        This->pPSDelegate = NULL;
+    }
+    if (This->pOleDelegate)
+    {
+        IOleObject_Release(This->pOleDelegate);
+        This->pOleDelegate = NULL;
+    }
+}
+
 /* undoes the work done by DefaultHandler_Run */
 static void DefaultHandler_Stop(DefaultHandler *This)
 {
@@ -432,18 +451,8 @@ static void DefaultHandler_Stop(DefaultHandler *This)
 
   if (This->dataAdviseHolder)
     DataAdviseHolder_OnDisconnect(This->dataAdviseHolder);
-  if (This->pDataDelegate)
-  {
-     IDataObject_Release(This->pDataDelegate);
-     This->pDataDelegate = NULL;
-  }
-  if (This->pPSDelegate)
-  {
-     IPersistStorage_Release(This->pPSDelegate);
-     This->pPSDelegate = NULL;
-  }
-  IOleObject_Release(This->pOleDelegate);
-  This->pOleDelegate = NULL;
+
+  release_delegates(This);
 }
 
 /************************************************************************




More information about the wine-cvs mailing list