[gtk/gtk-3-22] printing: Be more careful when deserializing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-22] printing: Be more careful when deserializing
- Date: Fri, 20 Apr 2018 21:58:17 +0000 (UTC)
commit 21fddc3994e5405cc914fd427aa8572f652d05aa
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Apr 20 16:56:28 2018 -0400
printing: Be more careful when deserializing
The GVariant we are getting here might not be coming
from GTK+, but rather from some other source. Best to
be forgiving and deal with missing data without crashing.
This was causing the GTK+ portal backends to crash on
print requests from Qt.
gtk/gtkpagesetup.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpagesetup.c b/gtk/gtkpagesetup.c
index 9c81343745..e1cbeb8573 100644
--- a/gtk/gtkpagesetup.c
+++ b/gtk/gtkpagesetup.c
@@ -902,8 +902,11 @@ gtk_page_setup_new_from_gvariant (GVariant *variant)
setup = gtk_page_setup_new ();
paper_size = gtk_paper_size_new_from_gvariant (variant);
- gtk_page_setup_set_paper_size (setup, paper_size);
- gtk_paper_size_free (paper_size);
+ if (paper_size)
+ {
+ gtk_page_setup_set_paper_size (setup, paper_size);
+ gtk_paper_size_free (paper_size);
+ }
if (g_variant_lookup (variant, "MarginTop", "d", &margin))
gtk_page_setup_set_top_margin (setup, margin, GTK_UNIT_MM);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]