Commit 04ee55e9 authored by Alberto Massari's avatar Alberto Massari Committed by Alexandre Julliard

- 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.
parent 574d4a91
...@@ -1516,8 +1516,6 @@ void WINAPI ReleaseStgMedium( ...@@ -1516,8 +1516,6 @@ void WINAPI ReleaseStgMedium(
if ( (pmedium->pUnkForRelease==0) && if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hGlobal!=0) ) (pmedium->u.hGlobal!=0) )
GlobalFree(pmedium->u.hGlobal); GlobalFree(pmedium->u.hGlobal);
pmedium->u.hGlobal = 0;
break; break;
} }
case TYMED_FILE: case TYMED_FILE:
...@@ -1531,8 +1529,6 @@ void WINAPI ReleaseStgMedium( ...@@ -1531,8 +1529,6 @@ void WINAPI ReleaseStgMedium(
CoTaskMemFree(pmedium->u.lpszFileName); CoTaskMemFree(pmedium->u.lpszFileName);
} }
pmedium->u.lpszFileName = 0;
break; break;
} }
case TYMED_ISTREAM: case TYMED_ISTREAM:
...@@ -1541,8 +1537,6 @@ void WINAPI ReleaseStgMedium( ...@@ -1541,8 +1537,6 @@ void WINAPI ReleaseStgMedium(
{ {
IStream_Release(pmedium->u.pstm); IStream_Release(pmedium->u.pstm);
} }
pmedium->u.pstm = 0;
break; break;
} }
case TYMED_ISTORAGE: case TYMED_ISTORAGE:
...@@ -1551,17 +1545,13 @@ void WINAPI ReleaseStgMedium( ...@@ -1551,17 +1545,13 @@ void WINAPI ReleaseStgMedium(
{ {
IStorage_Release(pmedium->u.pstg); IStorage_Release(pmedium->u.pstg);
} }
pmedium->u.pstg = 0;
break; break;
} }
case TYMED_GDI: case TYMED_GDI:
{ {
if ( (pmedium->pUnkForRelease==0) && if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hGlobal!=0) ) (pmedium->u.hBitmap!=0) )
DeleteObject(pmedium->u.hGlobal); DeleteObject(pmedium->u.hBitmap);
pmedium->u.hGlobal = 0;
break; break;
} }
case TYMED_MFPICT: case TYMED_MFPICT:
...@@ -1569,13 +1559,11 @@ void WINAPI ReleaseStgMedium( ...@@ -1569,13 +1559,11 @@ void WINAPI ReleaseStgMedium(
if ( (pmedium->pUnkForRelease==0) && if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hMetaFilePict!=0) ) (pmedium->u.hMetaFilePict!=0) )
{ {
LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hGlobal); LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
DeleteMetaFile(pMP->hMF); DeleteMetaFile(pMP->hMF);
GlobalUnlock(pmedium->u.hGlobal); GlobalUnlock(pmedium->u.hMetaFilePict);
GlobalFree(pmedium->u.hGlobal); GlobalFree(pmedium->u.hMetaFilePict);
} }
pmedium->u.hMetaFilePict = 0;
break; break;
} }
case TYMED_ENHMF: case TYMED_ENHMF:
...@@ -1585,14 +1573,13 @@ void WINAPI ReleaseStgMedium( ...@@ -1585,14 +1573,13 @@ void WINAPI ReleaseStgMedium(
{ {
DeleteEnhMetaFile(pmedium->u.hEnhMetaFile); DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
} }
pmedium->u.hEnhMetaFile = 0;
break; break;
} }
case TYMED_NULL: case TYMED_NULL:
default: default:
break; break;
} }
pmedium->tymed=TYMED_NULL;
/* /*
* After cleaning up, the unknown is released * After cleaning up, the unknown is released
......
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