Rob Shearman : ole32: Fix HandsOffStorage in the data cache.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 5 04:50:59 CST 2006


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Dec  4 15:51:25 2006 +0000

ole32: Fix HandsOffStorage in the data cache.

---

 dlls/ole32/datacache.c  |   13 +++++++++++++
 dlls/ole32/tests/ole2.c |    2 --
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 54d25ea..0e7666a 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -739,6 +739,15 @@ static inline HRESULT DataCacheEntry_Dis
     return S_OK;
 }
 
+static inline void DataCacheEntry_HandsOffStorage(DataCacheEntry *This)
+{
+    if (This->storage)
+    {
+        IStorage_Release(This->storage);
+        This->storage = NULL;
+    }
+}
+
 /*********************************************************
  * Method implementation for the  non delegating IUnknown
  * part of the DataCache class.
@@ -1469,6 +1478,7 @@ static HRESULT WINAPI DataCache_HandsOff
             IPersistStorage* iface)
 {
   DataCache *this = impl_from_IPersistStorage(iface);
+  DataCacheEntry *cache_entry;
 
   TRACE("(%p)\n", iface);
 
@@ -1478,6 +1488,9 @@ static HRESULT WINAPI DataCache_HandsOff
     this->presentationStorage = NULL;
   }
 
+  LIST_FOR_EACH_ENTRY(cache_entry, &this->cache_list, DataCacheEntry, entry)
+    DataCacheEntry_HandsOffStorage(cache_entry);
+
   return S_OK;
 }
 
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index 24e981a..a2f61c8 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -1273,9 +1273,7 @@ static void test_data_cache(void)
     hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
     ok_ole_success(hr, "IOleCache2_DiscardCache");
     hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
-    todo_wine {
     ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
-    }
 
     DeleteDC(hdcMem);
 




More information about the wine-cvs mailing list