forked from AuroraMiddleware/gtk
file printbackend: Protect a callback by GDK_THREADS_ENTER
https://bugzilla.gnome.org/show_bug.cgi?id=649569
This commit is contained in:
parent
5eb286b744
commit
01a3345c06
@ -370,15 +370,14 @@ typedef struct {
|
|||||||
GDestroyNotify dnotify;
|
GDestroyNotify dnotify;
|
||||||
} _PrintStreamData;
|
} _PrintStreamData;
|
||||||
|
|
||||||
|
/* expects GDK lock to be held */
|
||||||
static void
|
static void
|
||||||
file_print_cb (GtkPrintBackendFile *print_backend,
|
file_print_cb_locked (GtkPrintBackendFile *print_backend,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
_PrintStreamData *ps = (_PrintStreamData *) user_data;
|
_PrintStreamData *ps = (_PrintStreamData *) user_data;
|
||||||
|
|
||||||
GDK_THREADS_ENTER ();
|
|
||||||
|
|
||||||
if (ps->target_io_stream != NULL)
|
if (ps->target_io_stream != NULL)
|
||||||
g_output_stream_close (G_OUTPUT_STREAM (ps->target_io_stream), NULL, NULL);
|
g_output_stream_close (G_OUTPUT_STREAM (ps->target_io_stream), NULL, NULL);
|
||||||
|
|
||||||
@ -393,8 +392,18 @@ file_print_cb (GtkPrintBackendFile *print_backend,
|
|||||||
|
|
||||||
if (ps->job)
|
if (ps->job)
|
||||||
g_object_unref (ps->job);
|
g_object_unref (ps->job);
|
||||||
|
|
||||||
g_free (ps);
|
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 ();
|
GDK_THREADS_LEAVE ();
|
||||||
}
|
}
|
||||||
@ -412,7 +421,7 @@ file_write (GIOChannel *source,
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
read_status =
|
read_status =
|
||||||
g_io_channel_read_chars (source,
|
g_io_channel_read_chars (source,
|
||||||
buf,
|
buf,
|
||||||
_STREAM_MAX_CHUNK_SIZE,
|
_STREAM_MAX_CHUNK_SIZE,
|
||||||
@ -490,8 +499,8 @@ gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
|
|||||||
error:
|
error:
|
||||||
if (internal_error != NULL)
|
if (internal_error != NULL)
|
||||||
{
|
{
|
||||||
file_print_cb (GTK_PRINT_BACKEND_FILE (print_backend),
|
file_print_cb_locked (GTK_PRINT_BACKEND_FILE (print_backend),
|
||||||
internal_error, ps);
|
internal_error, ps);
|
||||||
|
|
||||||
g_error_free (internal_error);
|
g_error_free (internal_error);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user