Avoid use of GDBusServer object after it is destroyed

This commit is contained in:
Paul Cornett 2017-10-27 10:05:43 -07:00
parent 677051b6e7
commit 44b30c1a60

View File

@ -391,6 +391,7 @@ wxgtk_webview_webkit_counted_matches(WebKitFindController *,
*findCount = match_count; *findCount = match_count;
} }
static bool z;
static void static void
wxgtk_initialize_web_extensions(WebKitWebContext *context, wxgtk_initialize_web_extensions(WebKitWebContext *context,
GDBusServer *dbusServer) GDBusServer *dbusServer)
@ -401,6 +402,7 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context,
WX_WEB_EXTENSIONS_DIRECTORY); WX_WEB_EXTENSIONS_DIRECTORY);
webkit_web_context_set_web_extensions_initialization_user_data(context, webkit_web_context_set_web_extensions_initialization_user_data(context,
user_data); user_data);
z = true;
} }
static gboolean static gboolean
@ -505,6 +507,9 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
m_dbusServer); m_dbusServer);
m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
while (!z)
gtk_main_iteration();
GTKCreateScrolledWindowWith(GTK_WIDGET(m_web_view)); GTKCreateScrolledWindowWith(GTK_WIDGET(m_web_view));
g_object_ref(m_widget); g_object_ref(m_widget);
@ -552,7 +557,12 @@ wxWebViewWebKit::~wxWebViewWebKit()
if (m_web_view) if (m_web_view)
GTKDisconnect(m_web_view); GTKDisconnect(m_web_view);
if (m_dbusServer) if (m_dbusServer)
{
g_dbus_server_stop(m_dbusServer); g_dbus_server_stop(m_dbusServer);
g_signal_handlers_disconnect_matched(
webkit_web_context_get_default(), G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, m_dbusServer);
}
g_clear_object(&m_dbusServer); g_clear_object(&m_dbusServer);
g_clear_object(&m_extension); g_clear_object(&m_extension);
} }