Allow initializing wxWidgets multiple times against one instance of GTK+

See #17751
This commit is contained in:
Paul Cornett 2016-12-15 19:37:12 -08:00
parent 85302845ab
commit db9858a93c
2 changed files with 25 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/toplevel.h" #include "wx/toplevel.h"
#include "wx/module.h"
#endif #endif
#include "wx/fontutil.h" #include "wx/fontutil.h"
@ -1008,3 +1009,23 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
return false; return false;
} }
} }
#ifdef __WXGTK3__
class wxSystemSettingsModule: public wxModule
{
public:
virtual bool OnInit() wxOVERRIDE { return true; }
virtual void OnExit() wxOVERRIDE;
wxDECLARE_DYNAMIC_CLASS(wxSystemSettingsModule);
};
wxIMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule);
void wxSystemSettingsModule::OnExit()
{
GtkSettings* settings = gtk_settings_get_default();
g_signal_handlers_disconnect_by_func(settings,
(void*)notify_gtk_theme_name, NULL);
g_signal_handlers_disconnect_by_func(settings,
(void*)notify_gtk_font_name, NULL);
}
#endif

View File

@ -325,6 +325,10 @@ GType wxPizza::type()
static GType type; static GType type;
if (type == 0) if (type == 0)
{ {
type = g_type_from_name("wxPizza");
if (type)
return type;
const GTypeInfo info = { const GTypeInfo info = {
sizeof(wxPizzaClass), sizeof(wxPizzaClass),
NULL, NULL, NULL, NULL,