X-Git-Url: http://git.jankratochvil.net/?p=captive.git;a=blobdiff_plain;f=src%2Finstall%2Facquire%2Fui-gnome.c;h=57862bc2a23a9b5899f6ad75188ce8725dc5cd85;hp=2e8df89e39afa413583d927a293fb2d026e7ded1;hb=8d636786b1e3b196db0facd8aaf43845e46a0c05;hpb=47bec9232eb49a2f9b4e0e93fee1b22728d90207 diff --git a/src/install/acquire/ui-gnome.c b/src/install/acquire/ui-gnome.c index 2e8df89..57862bc 100644 --- a/src/install/acquire/ui-gnome.c +++ b/src/install/acquire/ui-gnome.c @@ -586,6 +586,9 @@ gint reply; (GnomeReplyCallback)on_DruidButtonOK_clicked_dialog_callback, &reply); /* data */ g_signal_connect((gpointer)dialog,"close",G_CALLBACK(gtk_main_quit),NULL); + /* Never call gtk_main() from other thread than the initial one. + * We would have to switch GTK+ context (g_main_context()?). + */ gtk_main(); /* 'dialog' gets destroyed automatically */ if (reply==0) /* 0 for 'OK', 1 for 'Cancel', left -1 for dialog close. */ @@ -628,6 +631,8 @@ GtkTreeViewColumn *column; GtkCellRenderer *cell; GtkBox *druid_button_box; + gdk_threads_enter(); + App=GNOME_APP(create_App()); DriversTreeView=GTK_TREE_VIEW(lookup_widget(GTK_WIDGET(App),"DriversTreeView")); @@ -690,6 +695,8 @@ GtkBox *druid_button_box; NULL); /* callback_data */ state_changed(); + + gdk_threads_leave(); } static void ui_gnome_g_log_handler(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data) @@ -720,16 +727,14 @@ GtkWidget *dialog; static void ui_gnome_interactive(void) { - gtk_widget_show_all(GTK_WIDGET(App)); + gdk_threads_enter(); - if (!g_thread_supported()) - g_thread_init(NULL); - if (!gdk_threads_mutex) - gdk_threads_init(); + gtk_widget_show_all(GTK_WIDGET(App)); - gdk_threads_enter(); gtk_main(); + gdk_threads_leave(); + exit(EXIT_SUCCESS); } @@ -742,6 +747,14 @@ gboolean ui_gnome_init(void) ui_interactive=ui_gnome_interactive; captivemodid_module_best_priority_notify=ui_gnome_module_best_priority_notify; + /* gdk_threads_init() must be called before gtk_init()! + * gtk_init() gets called by create_App() here. + */ + if (!g_thread_supported()) + g_thread_init(NULL); + if (!gdk_threads_mutex) + gdk_threads_init(); + /* Graphic widgets will all be hidden yet. */ App_init(); /* ui_gnome_g_log_handler() needs 'App'. */