- virtual bool OnInit() { return true; }
- virtual void OnExit() { delete (wxFontMapperBase*)wxFontMapperBase::Set(NULL); }
+
+ virtual bool OnInit()
+ {
+ // a dummy wxFontMapperBase object could have been created during the
+ // program startup before wxApp was created, we have to delete it to
+ // allow creating the real font mapper next time it is needed now that
+ // we can create it (when the modules are initialized, wxApp object
+ // already exists)
+ wxFontMapperBase *fm = wxFontMapperBase::Get();
+ if ( fm && fm->IsDummy() )
+ wxFontMapperBase::Reset();
+
+ return true;
+ }
+
+ virtual void OnExit()
+ {
+ wxFontMapperBase::Reset();
+ }