diff --git a/ChangeLog b/ChangeLog index 0c962a9356..e01141b6d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-05-15 Alexander Larsson + + * gtk/gtk.symbols: + * gtk/gtkprintbackend.[ch]: (_gtk_print_backend_create): + Never unload print backends. + Remove gtk_print_backend_unref_at_idle. + + * modules/printbackends/cups/gtkprintbackendcups.c: + (cups_dispatch_watch_finalize): + Don't use the unref_at_idle hack since that caused + deadlocks. Instead we never unload print backends, which + is not really a big problem. + 2006-05-14 Murray Cumming * gtk/gtkframe.c: Restored the / at the start of the comment diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0c962a9356..e01141b6d6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2006-05-15 Alexander Larsson + + * gtk/gtk.symbols: + * gtk/gtkprintbackend.[ch]: (_gtk_print_backend_create): + Never unload print backends. + Remove gtk_print_backend_unref_at_idle. + + * modules/printbackends/cups/gtkprintbackendcups.c: + (cups_dispatch_watch_finalize): + Don't use the unref_at_idle hack since that caused + deadlocks. Instead we never unload print backends, which + is not really a big problem. + 2006-05-14 Murray Cumming * gtk/gtkframe.c: Restored the / at the start of the comment diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 2afc6788fb..26d1226105 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -2559,7 +2559,6 @@ gtk_print_backend_printer_list_is_done gtk_print_backend_find_printer gtk_print_backend_print_stream gtk_print_backend_load_modules -gtk_print_backend_unref_at_idle #endif #endif #endif diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c index 017b4c7283..9bd1069a92 100644 --- a/gtk/gtkprintbackend.c +++ b/gtk/gtkprintbackend.c @@ -227,6 +227,11 @@ _gtk_print_backend_create (const char *backend_name) pb_module); pb = _gtk_print_backend_module_create (pb_module); + + /* Increase use-count so that we don't unload print backends. + There is a problem with module unloading in the cups module, + see cups_dispatch_watch_finalize for details. */ + g_type_module_use (G_TYPE_MODULE (pb_module)); } g_free (module_path); @@ -521,19 +526,6 @@ gtk_print_backend_print_stream (GtkPrintBackend *backend, dnotify); } -static gboolean -unref_at_idle_cb (gpointer data) -{ - g_object_unref (data); - return FALSE; -} - -void -gtk_print_backend_unref_at_idle (GtkPrintBackend *print_backend) -{ - g_idle_add (unref_at_idle_cb, print_backend); -} - void gtk_print_backend_destroy (GtkPrintBackend *print_backend) { diff --git a/gtk/gtkprintbackend.h b/gtk/gtkprintbackend.h index 61021fcd93..7f688ae0fc 100644 --- a/gtk/gtkprintbackend.h +++ b/gtk/gtkprintbackend.h @@ -137,7 +137,6 @@ void gtk_print_backend_print_stream (GtkPrintBackend *pri gpointer user_data, GDestroyNotify dnotify); GList * gtk_print_backend_load_modules (void); -void gtk_print_backend_unref_at_idle (GtkPrintBackend *print_backend); void gtk_print_backend_destroy (GtkPrintBackend *print_backend); /* Backend-only functions for GtkPrintBackend */ diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 3380d8970d..006e5d446f 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -547,10 +547,15 @@ cups_dispatch_watch_finalize (GSource *source) if (dispatch->backend) { /* We need to unref this at idle time, because it might be the - last reference to this module causing the code to be - unloaded (including this particular function!) - */ - gtk_print_backend_unref_at_idle (GTK_PRINT_BACKEND (dispatch->backend)); + * last reference to this module causing the code to be + * unloaded (including this particular function!) + * Update: Doing this at idle caused a deadlock taking the + * mainloop context lock while being in a GSource callout for + * multithreaded apps. So, for now we just disable unloading + * of print backends. See _gtk_print_backend_create for the + * disabling. + */ + g_object_unref (dispatch->backend); dispatch->backend = NULL; }