Bug 1401069 - Part 1. Release EMF handle before function exist.
This is to make the behavior of WindowsEMF::Playback be consentient with WindowsEMF::SaveToFile.
MozReview-Commit-ID: GANdQ7MtEPq
--- a/widget/windows/WindowsEMF.cpp
+++ b/widget/windows/WindowsEMF.cpp
@@ -64,23 +64,27 @@ WindowsEMF::ReleaseEMFHandle()
bool
WindowsEMF::Playback(HDC aDeviceContext, const RECT* aRect)
{
MOZ_ASSERT(aRect);
if (!FinishDocument()) {
return false;
}
- return ::PlayEnhMetaFile(aDeviceContext, mEmf, aRect) != 0;
+ bool result = ::PlayEnhMetaFile(aDeviceContext, mEmf, aRect) != 0;
+ ReleaseEMFHandle();
+
+ return result;
}
bool
WindowsEMF::SaveToFile()
{
if (!FinishDocument()) {
return false;
}
+
ReleaseEMFHandle();
return true;
}
} // namespace widget
} // namespace mozilla
\ No newline at end of file