From 669af158dadf3635abcae95a72f3570ebe28a8f0 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 19 Nov 2009 14:02:23 -0600 Subject: [PATCH] ole32: Invalidate open storage objects that are deleted. --- dlls/ole32/storage32.c | 10 ++++++++++ dlls/ole32/tests/storage32.c | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 4e667c6a8d6..708f2633049 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -1936,6 +1936,16 @@ static HRESULT deleteStorageContents( STATSTG currentElement; HRESULT hr; HRESULT destroyHr = S_OK; + StorageInternalImpl *stg, *stg2; + + /* Invalidate any open storage objects. */ + LIST_FOR_EACH_ENTRY_SAFE(stg, stg2, &parentStorage->storageHead, StorageInternalImpl, ParentListEntry) + { + if (stg->base.storageDirEntry == indexToDelete) + { + StorageInternalImpl_Invalidate(stg); + } + } /* * Open the storage and enumerate it diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 05d1473bea6..53811dbb514 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -1076,19 +1076,15 @@ static void test_substorage_share(void) ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08x\n", r); if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, stgname); -#if 0 - /* This crashes on Wine. */ - /* destroying an object while it's open invalidates it */ r = IStorage_DestroyElement(stg, stgname); ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r); r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); - todo_wine ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08x\n", r); + ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08x\n", r); if (r == S_OK) IStorage_Release(stm); -#endif IStorage_Release(stg2); }