diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-05-17 20:02:13 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-05-23 11:12:56 +0200 |
commit | 7437a79b851d9d77c5fa820e08b6fa037c882169 (patch) | |
tree | 349835131154c8c087d2ac1f3eecc03635957401 /gtk | |
parent | e18a4fa047b6b8c0cf8aab251fc661e38b2b5352 (diff) | |
download | gtk+-7437a79b851d9d77c5fa820e08b6fa037c882169.tar.gz |
Fix a crash when printing with defer drawing enabled
Fixes bgo#582963
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkprintoperation.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index 4c9b9be20e..d0e6fb9aae 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -1946,7 +1946,8 @@ typedef struct GtkWidget *progress; gboolean initialized; - gboolean is_preview; + gboolean is_preview; + gboolean done; } PrintPagesData; static void @@ -1989,7 +1990,7 @@ clamp_page_ranges (PrintPagesData *data) data->num_ranges = num_of_correct_ranges; } -static gboolean +static void increment_page_sequence (PrintPagesData *data) { GtkPrintOperationPrivate *priv = data->op->priv; @@ -2006,7 +2007,10 @@ increment_page_sequence (PrintPagesData *data) data->uncollated++; } else - return FALSE; + { + data->done = TRUE; + return; + } } else { @@ -2033,11 +2037,14 @@ increment_page_sequence (PrintPagesData *data) priv->page_position >= priv->nr_of_pages_to_print || data->sheet < 0 || data->sheet >= data->num_of_sheets) - return FALSE; + { + data->done = TRUE; + return; + } else data->page = data->pages[priv->page_position]; - return TRUE; + return; } else data->collated = 0; @@ -2060,13 +2067,14 @@ increment_page_sequence (PrintPagesData *data) priv->page_position >= priv->nr_of_pages_to_print || data->sheet < 0 || data->sheet >= data->num_of_sheets) - return FALSE; + { + data->done = TRUE; + return; + } else data->page = data->pages[priv->page_position]; data->total++; - - return TRUE; } static void @@ -2581,7 +2589,7 @@ static gboolean print_pages_idle (gpointer user_data) { PrintPagesData *data; - GtkPrintOperationPrivate *priv; + GtkPrintOperationPrivate *priv; gboolean done = FALSE; data = (PrintPagesData*)user_data; @@ -2603,10 +2611,13 @@ print_pages_idle (gpointer user_data) goto out; } - common_render_page (data->op, data->page); - - if (!increment_page_sequence (data)) - done = TRUE; + if (!data->done) + { + common_render_page (data->op, data->page); + increment_page_sequence (data); + } + else + done = priv->page_drawing_state == GTK_PAGE_DRAWING_STATE_READY; out: |