Fix RemoveUnused tool for crash caused by Gtk introspection bug

Fixes #11634
This commit is contained in:
prculley 2020-03-31 09:35:55 -05:00 committed by Paul Culley
parent f1f8847a86
commit 924d82a7c4

View File

@ -172,7 +172,11 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
GObject.TYPE_STRING, GObject.TYPE_STRING,
GObject.TYPE_STRING, GObject.TYPE_STRING,
GObject.TYPE_STRING) GObject.TYPE_STRING)
self.sort_model = self.real_model.sort_new_with_model() # a short term Gtk introspection means we need to try both ways:
if hasattr(self.real_model, "sort_new_with_model"):
self.sort_model = self.real_model.sort_new_with_model()
else:
self.sort_model = Gtk.TreeModelSort.new_with_model(self.real_model)
self.warn_tree.set_model(self.sort_model) self.warn_tree.set_model(self.sort_model)
self.renderer = Gtk.CellRendererText() self.renderer = Gtk.CellRendererText()