Clean up private fonts on library shut down under MSW
Ensure we don't keep the values in the global gs_privateFontFileNames variable if the library is shutdown and reinitialized later, this would be unexpected.
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/module.h"
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
@@ -1103,6 +1104,22 @@ extern const wxArrayString& wxGetPrivateFontFileNames()
|
|||||||
return gs_privateFontFileNames;
|
return gs_privateFontFileNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to use a module to clean up the list of private fonts when the
|
||||||
|
// library is shut down.
|
||||||
|
class wxPrivateFontsListModule : public wxModule
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxPrivateFontsListModule() { }
|
||||||
|
|
||||||
|
bool OnInit() wxOVERRIDE { return true; }
|
||||||
|
void OnExit() wxOVERRIDE { gs_privateFontFileNames.clear(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxDECLARE_DYNAMIC_CLASS(wxPrivateFontsListModule);
|
||||||
|
};
|
||||||
|
|
||||||
|
wxIMPLEMENT_DYNAMIC_CLASS(wxPrivateFontsListModule, wxModule);
|
||||||
|
|
||||||
bool wxFontBase::AddPrivateFont(const wxString& filename)
|
bool wxFontBase::AddPrivateFont(const wxString& filename)
|
||||||
{
|
{
|
||||||
if ( !wxFileName::FileExists(filename) )
|
if ( !wxFileName::FileExists(filename) )
|
||||||
|
Reference in New Issue
Block a user