diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index ec4b39a7761d..f0c5e332839c 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -70,6 +70,8 @@ public: // checks if the menuhandle was created by VCL bool IsKnownMenuHandle( HMENU hMenu ); + bool mbResourcesAlreadyFreed; + public: HINSTANCE mhInst; // default instance handle HINSTANCE mhPrevInst; // previous instance handle diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 31af87670d59..50c0f8efe83e 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -113,6 +113,8 @@ void ImplInitSalGDI() { SalData* pSalData = GetSalData(); + pSalData->mbResourcesAlreadyFreed = false; + // init stock brushes pSalData->maStockPenColorAry[0] = PALETTERGB( 0, 0, 0 ); pSalData->maStockPenColorAry[1] = PALETTERGB( 0xFF, 0xFF, 0xFF ); @@ -290,6 +292,9 @@ void ImplFreeSalGDI() { SalData* pSalData = GetSalData(); + if (pSalData->mbResourcesAlreadyFreed) + return; + // destroy stock objects int i; for ( i = 0; i < pSalData->mnStockPenCount; i++ ) @@ -356,6 +361,8 @@ void ImplFreeSalGDI() // delete temporary font list ImplReleaseTempFonts( *pSalData ); + + pSalData->mbResourcesAlreadyFreed = true; } static int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue )