diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2018-02-02 16:34:40 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2018-02-03 12:07:10 +0100 |
commit | 888dfe499d92a434c3ce703df7057c4703a6c75e (patch) | |
tree | 91e393aadfe75f32a819f9e78deac024977918dd /modules | |
parent | c655759cefa56efdb0cb943bb5dada3ff75a963c (diff) | |
download | gtk+-888dfe499d92a434c3ce703df7057c4703a6c75e.tar.gz |
Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.
Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.
During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.
https://bugzilla.gnome.org/show_bug.cgi?id=793124
Diffstat (limited to 'modules')
-rw-r--r-- | modules/input/gtkimcontextmultipress.c | 4 | ||||
-rw-r--r-- | modules/printbackends/cups/gtkprintbackendcups.c | 32 | ||||
-rw-r--r-- | modules/printbackends/file/gtkprintbackendfile.c | 27 |
3 files changed, 11 insertions, 52 deletions
diff --git a/modules/input/gtkimcontextmultipress.c b/modules/input/gtkimcontextmultipress.c index f62e42b1b8..d3c52b08c3 100644 --- a/modules/input/gtkimcontextmultipress.c +++ b/modules/input/gtkimcontextmultipress.c @@ -201,8 +201,6 @@ on_timeout (gpointer data) { GtkImContextMultipress *multipress_context; - gdk_threads_enter (); - multipress_context = GTK_IM_CONTEXT_MULTIPRESS (data); /* A certain amount of time has passed, so we will assume that the user @@ -211,8 +209,6 @@ on_timeout (gpointer data) multipress_context->timeout_id = 0; - gdk_threads_leave (); - return G_SOURCE_REMOVE; /* don't call me again */ } diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 4e6091ea2d..40e7a61375 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -553,8 +553,6 @@ cups_print_cb (GtkPrintBackendCups *print_backend, GError *error = NULL; CupsPrintStreamData *ps = user_data; - gdk_threads_enter (); - GTK_NOTE (PRINTING, g_print ("CUPS Backend: %s\n", G_STRFUNC)); @@ -589,8 +587,6 @@ cups_print_cb (GtkPrintBackendCups *print_backend, if (error) g_error_free (error); - - gdk_threads_leave (); } typedef struct { @@ -1709,12 +1705,10 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend, int state; gboolean done; - gdk_threads_enter (); - if (data->job == NULL) { cups_job_poll_data_free (data); - goto done; + return; } data->counter++; @@ -1781,9 +1775,6 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend, } else cups_job_poll_data_free (data); - -done: - gdk_threads_leave (); } static void @@ -2682,8 +2673,6 @@ cups_request_printer_info_cb (GtkPrintBackendCups *cups_backend, gboolean status_changed = FALSE; ipp_t *response; - gdk_threads_enter (); - GTK_NOTE (PRINTING, g_print ("CUPS Backend: %s\n", G_STRFUNC)); @@ -2783,8 +2772,6 @@ done: } printer_setup_info_free (info); - - gdk_threads_leave (); } static void @@ -3454,8 +3441,6 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, gchar *remote_default_printer = NULL; GList *iter; - gdk_threads_enter (); - list_has_changed = FALSE; GTK_NOTE (PRINTING, @@ -3669,8 +3654,6 @@ done: set_default_printer (cups_backend, cups_backend->avahi_default_printer); } #endif - - gdk_threads_leave (); } static void @@ -3790,8 +3773,6 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, GtkPrinter *printer; struct stat data_info; - gdk_threads_enter (); - GTK_NOTE (PRINTING, g_print ("CUPS Backend: %s\n", G_STRFUNC)); @@ -3815,7 +3796,7 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, g_signal_emit_by_name (printer, "details-acquired", success); - goto done; + return; } #endif @@ -3846,15 +3827,12 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, GTK_PRINTER_CUPS (printer)->port, GTK_PRINT_BACKEND_CUPS (gtk_printer_get_backend (printer))); - goto done; + return; } #endif gtk_printer_set_has_details (printer, TRUE); g_signal_emit_by_name (printer, "details-acquired", TRUE); - -done: - gdk_threads_leave (); } static gboolean @@ -4204,8 +4182,6 @@ cups_request_default_printer_cb (GtkPrintBackendCups *print_backend, ipp_attribute_t *attr; GtkPrinter *printer; - gdk_threads_enter (); - if (gtk_cups_result_is_error (result)) { if (gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_AUTH && @@ -4242,8 +4218,6 @@ cups_request_default_printer_cb (GtkPrintBackendCups *print_backend, */ if (print_backend->list_printers_poll != 0) cups_request_printer_list (print_backend); - - gdk_threads_leave (); } static gboolean diff --git a/modules/printbackends/file/gtkprintbackendfile.c b/modules/printbackends/file/gtkprintbackendfile.c index c584b19f9d..775af6647c 100644 --- a/modules/printbackends/file/gtkprintbackendfile.c +++ b/modules/printbackends/file/gtkprintbackendfile.c @@ -378,11 +378,10 @@ typedef struct { GDestroyNotify dnotify; } _PrintStreamData; -/* expects GDK lock to be held */ static void -file_print_cb_locked (GtkPrintBackendFile *print_backend, - GError *error, - gpointer user_data) +file_print_cb (GtkPrintBackendFile *print_backend, + GError *error, + gpointer user_data) { gchar *uri; @@ -399,7 +398,9 @@ file_print_cb_locked (GtkPrintBackendFile *print_backend, ps->dnotify (ps->user_data); gtk_print_job_set_status (ps->job, - (error != NULL)?GTK_PRINT_STATUS_FINISHED_ABORTED:GTK_PRINT_STATUS_FINISHED); + (error != NULL) + ? GTK_PRINT_STATUS_FINISHED_ABORTED + : GTK_PRINT_STATUS_FINISHED); recent_manager = gtk_recent_manager_get_default (); uri = output_file_from_settings (gtk_print_job_get_settings (ps->job), NULL); @@ -412,18 +413,6 @@ file_print_cb_locked (GtkPrintBackendFile *print_backend, g_free (ps); } -static void -file_print_cb (GtkPrintBackendFile *print_backend, - GError *error, - gpointer user_data) -{ - gdk_threads_enter (); - - file_print_cb_locked (print_backend, error, user_data); - - gdk_threads_leave (); -} - static gboolean file_write (GIOChannel *source, GIOCondition con, @@ -515,8 +504,8 @@ gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend, error: if (internal_error != NULL) { - file_print_cb_locked (GTK_PRINT_BACKEND_FILE (print_backend), - internal_error, ps); + file_print_cb (GTK_PRINT_BACKEND_FILE (print_backend), + internal_error, ps); g_error_free (internal_error); return; |