Vincent Povirk : ole32: Always invalidate stream objects when deleting the stream.

Alexandre Julliard julliard at winehq.org
Thu Nov 19 10:15:18 CST 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Nov 18 10:22:50 2009 -0600

ole32: Always invalidate stream objects when deleting the stream.

---

 dlls/ole32/storage32.c       |   23 ++++++++++++-----------
 dlls/ole32/tests/storage32.c |    2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index df0305d..96e3e00 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -823,17 +823,6 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
      */
     if (STGM_CREATE_MODE(grfMode) == STGM_CREATE)
     {
-      StgStreamImpl *strm;
-
-      LIST_FOR_EACH_ENTRY(strm, &This->strmHead, StgStreamImpl, StrmListEntry)
-      {
-        if (strm->dirEntry == currentEntryRef)
-        {
-          TRACE("Stream deleted %p\n", strm);
-          strm->parentStorage = NULL;
-          list_remove(&strm->StrmListEntry);
-        }
-      }
       IStorage_DestroyElement(iface, pwcsName);
     }
     else
@@ -1914,6 +1903,18 @@ static HRESULT deleteStreamContents(
   IStream      *pis;
   HRESULT        hr;
   ULARGE_INTEGER size;
+  StgStreamImpl *strm;
+
+  /* Invalidate any open stream objects. */
+  LIST_FOR_EACH_ENTRY(strm, &parentStorage->strmHead, StgStreamImpl, StrmListEntry)
+  {
+    if (strm->dirEntry == indexToDelete)
+    {
+      TRACE("Stream deleted %p\n", strm);
+      strm->parentStorage = NULL;
+      list_remove(&strm->StrmListEntry);
+    }
+  }
 
   size.u.HighPart = 0;
   size.u.LowPart = 0;
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index b908ea5..8fa300f 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -1121,7 +1121,7 @@ static void test_substorage_share(void)
         ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r);
 
         r = IStream_Write(stm, "this shouldn't work\n", 20, NULL);
-        todo_wine ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
+        ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
 
         IStorage_Release(stm);
     }




More information about the wine-cvs mailing list