ole32: Invalidate open storage objects that are deleted.

This commit is contained in:
Vincent Povirk 2009-11-19 14:02:23 -06:00 committed by Alexandre Julliard
parent 8569d547b9
commit 669af158da
2 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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);
}