Commit 7437a79b authored by Carlos Garcia Campos's avatar Carlos Garcia Campos
Browse files

Fix a crash when printing with defer drawing enabled

Fixes bgo#582963
parent e18a4fa0
...@@ -1946,7 +1946,8 @@ typedef struct ...@@ -1946,7 +1946,8 @@ typedef struct
GtkWidget *progress; GtkWidget *progress;
gboolean initialized; gboolean initialized;
gboolean is_preview; gboolean is_preview;
gboolean done;
} PrintPagesData; } PrintPagesData;
static void static void
...@@ -1989,7 +1990,7 @@ clamp_page_ranges (PrintPagesData *data) ...@@ -1989,7 +1990,7 @@ clamp_page_ranges (PrintPagesData *data)
data->num_ranges = num_of_correct_ranges; data->num_ranges = num_of_correct_ranges;
} }
static gboolean static void
increment_page_sequence (PrintPagesData *data) increment_page_sequence (PrintPagesData *data)
{ {
GtkPrintOperationPrivate *priv = data->op->priv; GtkPrintOperationPrivate *priv = data->op->priv;
...@@ -2006,7 +2007,10 @@ increment_page_sequence (PrintPagesData *data) ...@@ -2006,7 +2007,10 @@ increment_page_sequence (PrintPagesData *data)
data->uncollated++; data->uncollated++;
} }
else else
return FALSE; {
data->done = TRUE;
return;
}
} }
else else
{ {
...@@ -2033,11 +2037,14 @@ increment_page_sequence (PrintPagesData *data) ...@@ -2033,11 +2037,14 @@ increment_page_sequence (PrintPagesData *data)
priv->page_position >= priv->nr_of_pages_to_print || priv->page_position >= priv->nr_of_pages_to_print ||
data->sheet < 0 || data->sheet < 0 ||
data->sheet >= data->num_of_sheets) data->sheet >= data->num_of_sheets)
return FALSE; {
data->done = TRUE;
return;
}
else else
data->page = data->pages[priv->page_position]; data->page = data->pages[priv->page_position];
return TRUE; return;
} }
else else
data->collated = 0; data->collated = 0;
...@@ -2060,13 +2067,14 @@ increment_page_sequence (PrintPagesData *data) ...@@ -2060,13 +2067,14 @@ increment_page_sequence (PrintPagesData *data)
priv->page_position >= priv->nr_of_pages_to_print || priv->page_position >= priv->nr_of_pages_to_print ||
data->sheet < 0 || data->sheet < 0 ||
data->sheet >= data->num_of_sheets) data->sheet >= data->num_of_sheets)
return FALSE; {
data->done = TRUE;
return;
}
else else
data->page = data->pages[priv->page_position]; data->page = data->pages[priv->page_position];
data->total++; data->total++;
return TRUE;
} }
static void static void
...@@ -2581,7 +2589,7 @@ static gboolean ...@@ -2581,7 +2589,7 @@ static gboolean
print_pages_idle (gpointer user_data) print_pages_idle (gpointer user_data)
{ {
PrintPagesData *data; PrintPagesData *data;
GtkPrintOperationPrivate *priv; GtkPrintOperationPrivate *priv;
gboolean done = FALSE; gboolean done = FALSE;
data = (PrintPagesData*)user_data; data = (PrintPagesData*)user_data;
...@@ -2603,10 +2611,13 @@ print_pages_idle (gpointer user_data) ...@@ -2603,10 +2611,13 @@ print_pages_idle (gpointer user_data)
goto out; goto out;
} }
common_render_page (data->op, data->page); if (!data->done)
{
if (!increment_page_sequence (data)) common_render_page (data->op, data->page);
done = TRUE; increment_page_sequence (data);
}
else
done = priv->page_drawing_state == GTK_PAGE_DRAWING_STATE_READY;
out: out:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment