Commit 9d0c4c97 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Always invalidate stream objects when deleting the stream.

parent a2c405fa
...@@ -823,17 +823,6 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream( ...@@ -823,17 +823,6 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
*/ */
if (STGM_CREATE_MODE(grfMode) == STGM_CREATE) 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); IStorage_DestroyElement(iface, pwcsName);
} }
else else
...@@ -1914,6 +1903,18 @@ static HRESULT deleteStreamContents( ...@@ -1914,6 +1903,18 @@ static HRESULT deleteStreamContents(
IStream *pis; IStream *pis;
HRESULT hr; HRESULT hr;
ULARGE_INTEGER size; 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.HighPart = 0;
size.u.LowPart = 0; size.u.LowPart = 0;
......
...@@ -1121,7 +1121,7 @@ static void test_substorage_share(void) ...@@ -1121,7 +1121,7 @@ static void test_substorage_share(void)
ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r); ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r);
r = IStream_Write(stm, "this shouldn't work\n", 20, NULL); 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); IStorage_Release(stm);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment