Skip to content
Permalink
Browse files
Defend against Gtk3 cursor new_from_name bug
On Ubuntu 16.10 and later, Gdk.Cursor raises a TypeError instead of
returning None as documented.

Fixes

    File "/usr/share/sugar/activities/Paint.activity/Area.py", line 1754, in
    set_tool_cursor
        cursor = Gdk.Cursor.new_from_name(display, name)
    TypeError: constructor returned NULL

Documentation reference:

https://lazka.github.io/pgi-docs/Gdk-3.0/classes/Cursor.html#Gdk.Cursor.new_from_name
  • Loading branch information
quozl committed Feb 8, 2017
1 parent 9318db9 commit 7e74623
Showing 1 changed file with 1 addition and 1 deletion.
@@ -1772,7 +1772,7 @@ def set_tool_cursor(self):

cursor = Gdk.Cursor.new_from_pixbuf(display, pixbuf,
hotspot_x, hotspot_y)
except GObject.GError:
except GObject.GError, TypeError:
cursor = None
if self.get_window() is not None:
self.get_window().set_cursor(cursor)

0 comments on commit 7e74623

Please sign in to comment.