Skip to content

Commit

Permalink
DeviceList: Remove Gtk.TreeIter from device_remove_event
Browse files Browse the repository at this point in the history
For some reason the iter goes invalid and we end up with below critical.
This happens calling clear() and try to compare the iter to the selected.

(blueman-manager:11183): Gtk-CRITICAL **: 09:48:11.834: gtk_list_store_get_path: assertion 'iter->stamp == priv->stamp' failed
  • Loading branch information
infirit committed Jul 7, 2019
1 parent dfa5e5f commit 8ccdf1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 4 additions & 5 deletions blueman/gui/DeviceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __on_manager_signal(self, manager, path, signal_name):
row = self.get(tree_iter, "device")
dev = row["device"]

self.device_remove_event(dev, tree_iter)
self.device_remove_event(dev)

def on_selection_changed(self, selection):
_model, tree_iter = selection.get_selected()
Expand Down Expand Up @@ -216,10 +216,9 @@ def row_update_event(self, tree_iter, key, value):
def device_add_event(self, device):
self.add_device(device)

def device_remove_event(self, device, tree_iter):
def device_remove_event(self, device):
logging.debug(device)
if tree_iter is None:
tree_iter = self.find_device(device)
tree_iter = self.find_device(device)

if self.compare(self.selected(), tree_iter):
self.emit("device-selected", None, None)
Expand Down Expand Up @@ -337,7 +336,7 @@ def clear(self):
for i in self.liststore:
tree_iter = i.iter
device = self.get(tree_iter, "device")["device"]
self.device_remove_event(device, tree_iter)
self.device_remove_event(device)
self.liststore.clear()
self.emit("device-selected", None, None)

Expand Down
6 changes: 4 additions & 2 deletions blueman/gui/manager/ManagerDeviceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ def make_device_icon(self, icon_info, is_paired=False, is_trusted=False):

return target

def device_remove_event(self, device, tree_iter):
def device_remove_event(self, device):
tree_iter = self.find_device(device)

row_fader = self.get(tree_iter, "row_fader")["row_fader"]
row_fader.connect("animation-finished", self.__on_fader_finished, device, tree_iter)
row_fader.thaw()
Expand All @@ -212,7 +214,7 @@ def device_remove_event(self, device, tree_iter):
def __on_fader_finished(self, fader, device, tree_iter):
fader.disconnect_by_func(self.__on_fader_finished)
fader.freeze()
super().device_remove_event(device, tree_iter)
super().device_remove_event(device)

def device_add_event(self, device):
self.add_device(device)
Expand Down

0 comments on commit 8ccdf1d

Please sign in to comment.