Comment 10 for bug 1548425

Revision history for this message
Marius Gedminas (mgedmin) wrote :

The crash is in the following code:

    def check_hovering(self, x, y):
        """Check if the mouse is above a tagged link and if yes show
           a hand cursor"""
        _hovering = False
        # get the iter at the mouse position
        iter = self.get_iter_at_location(x, y)

        # set _hovering if the iter has the tag "url"
        tags = iter.get_tags()

The error is "AttributeError: '_ResultTuple' object has no attribute 'get_tags'".

self is an instance of a subclass of Gtk.TextView, which has a `get_iter_at_location()` method that returns a tuple (bool, iterator): http://lazka.github.io/pgi-docs/#Gtk-3.0/classes/TextView.html#Gtk.TextView.get_iter_at_location

(I'm guessing PyGTK used to return just the iterator (or None), but with the migration to PyGObject + gobject-introspection + GTK+ 3.x this changed.)

Suggested fix: iter = self.get_iter_at_location(x, y)

This buggy code pattern is also repeated in button_press_event.