From a77ae5fb57084cd0ddd1cb89d43e8bbeb4c4f977 Mon Sep 17 00:00:00 2001 From: James Cameron Date: Tue, 2 Jan 2018 14:15:15 +1100 Subject: [PATCH] Activity.get_preview fails for no window in canvas When an activity deletes the window associated with the canvas, save may fail because Gdk.cairo_create is given an argument of None. Activity continues to run without a window. Reproduced with Chat activity and pressing Stop. Avoid exception by returning None from get_preview when there is no window. --- src/sugar3/activity/activity.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py index 5953ec64..956e967c 100644 --- a/src/sugar3/activity/activity.py +++ b/src/sugar3/activity/activity.py @@ -852,6 +852,9 @@ class Activity(Window, Gtk.Container): return None window = self.canvas.get_window() + if window is None: + return None + alloc = self.canvas.get_allocation() dummy_cr = Gdk.cairo_create(window)