OLE32: fixed ReleaseStgMedium
Alberto Massari
alby at exln.com
Tue Jan 14 05:48:35 CST 2003
The current behavior of ReleaseStgMedium is to perform the operation, then set the pointer to the object to NULL; instead, on Windows, the behavior is to perform the operation, then set the "tymed" enumerator to TYMED_NULL, leaving the pointer as it is. Internet Explorer 6 relies on this behavior to access the object after the STGMENIUM has been released.
With this patch, Internet Explorer 6.0 can be used with the built-in ole32.dll (that is, I can view a bunch of web sites before crashing on other problems...)
Changelog:
- align the cleanup phase of ReleaseStgMedium to the native API
- when the data is a bitmap or an enhanced metafile, use the correct data member (they are inside a union, so there is no practical difference, but this should be the right thing to do)
Alberto
Index: ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.39
diff -u -r1.39 ole2.c
--- ole2.c 7 Jan 2003 20:36:27 -0000 1.39
+++ ole2.c 14 Jan 2003 11:38:44 -0000
@@ -1513,8 +1513,6 @@
if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hGlobal!=0) )
GlobalFree(pmedium->u.hGlobal);
-
- pmedium->u.hGlobal = 0;
break;
}
case TYMED_FILE:
@@ -1528,8 +1526,6 @@
CoTaskMemFree(pmedium->u.lpszFileName);
}
-
- pmedium->u.lpszFileName = 0;
break;
}
case TYMED_ISTREAM:
@@ -1538,8 +1534,6 @@
{
IStream_Release(pmedium->u.pstm);
}
-
- pmedium->u.pstm = 0;
break;
}
case TYMED_ISTORAGE:
@@ -1548,17 +1542,13 @@
{
IStorage_Release(pmedium->u.pstg);
}
-
- pmedium->u.pstg = 0;
break;
}
case TYMED_GDI:
{
if ( (pmedium->pUnkForRelease==0) &&
- (pmedium->u.hGlobal!=0) )
- DeleteObject(pmedium->u.hGlobal);
-
- pmedium->u.hGlobal = 0;
+ (pmedium->u.hBitmap!=0) )
+ DeleteObject(pmedium->u.hBitmap);
break;
}
case TYMED_MFPICT:
@@ -1566,13 +1556,11 @@
if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hMetaFilePict!=0) )
{
- LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hGlobal);
+ LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
DeleteMetaFile(pMP->hMF);
- GlobalUnlock(pmedium->u.hGlobal);
- GlobalFree(pmedium->u.hGlobal);
+ GlobalUnlock(pmedium->u.hMetaFilePict);
+ GlobalFree(pmedium->u.hMetaFilePict);
}
-
- pmedium->u.hMetaFilePict = 0;
break;
}
case TYMED_ENHMF:
@@ -1582,14 +1570,13 @@
{
DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
}
-
- pmedium->u.hEnhMetaFile = 0;
break;
}
case TYMED_NULL:
default:
break;
}
+ pmedium->tymed=TYMED_NULL;
/*
* After cleaning up, the unknown is released
More information about the wine-patches
mailing list