Never unload print backends. Remove gtk_print_backend_unref_at_idle.

2006-05-15  Alexander Larsson  <alexl@redhat.com>

	* 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.
This commit is contained in:
Alexander Larsson 2006-05-15 15:24:12 +00:00 committed by Alexander Larsson
parent 62ede1134c
commit 5e0dc70323
6 changed files with 40 additions and 19 deletions

View File

@ -1,3 +1,16 @@
2006-05-15 Alexander Larsson <alexl@redhat.com>
* 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 <murrayc@murray.com>
* gtk/gtkframe.c: Restored the / at the start of the comment

View File

@ -1,3 +1,16 @@
2006-05-15 Alexander Larsson <alexl@redhat.com>
* 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 <murrayc@murray.com>
* gtk/gtkframe.c: Restored the / at the start of the comment

View File

@ -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

View File

@ -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)
{

View File

@ -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 */

View File

@ -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;
}