Allow initializing wxWidgets multiple times against one instance of GTK+

See #17751

(backport of db9858a93c)
This commit is contained in:
Paul Cornett
2016-12-15 19:41:32 -08:00
parent 1690d8b886
commit 21c1c5520d
2 changed files with 25 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
#ifndef WX_PRECOMP
#include "wx/toplevel.h"
#include "wx/module.h"
#endif
#include "wx/fontutil.h"
@@ -958,3 +959,23 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
return false;
}
}
#ifdef __WXGTK3__
class wxSystemSettingsModule: public wxModule
{
public:
virtual bool OnInit() { return true; }
virtual void OnExit();
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

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