Skip to content

Commit

Permalink
Correct segmentation fault in Wayland and minor bug with drag'n'drop (#1
Browse files Browse the repository at this point in the history
)

the `get_device_position` method gives a segfault in wayland.

Steps to reproduce:

- open deluge-gtk in a linux wayland session.
- make sure LabelPlus plugin is loaded.
- click on a torrent in the main window list.
- deluge-gtk crashes with segfault.
  • Loading branch information
getzze authored Oct 30, 2022
1 parent f4aec22 commit 4179700
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions labelplus/gtkui/common/gtklib/dnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ def remove_target(self, name):

def _do_drag_button_press(self, widget, event):

_, x, y, _ = widget.get_bin_window().get_device_position(event.get_source_device())
pos = widget.convert_bin_window_to_tree_coords(x, y)
if pos[1] < 0:
if event.y < 0:
return False

log.debug("%s Do button-press at b(%d, %d), Button: %s",
Expand Down Expand Up @@ -655,14 +653,9 @@ def _find_target(self, widget, context):
if src and not same:

targets = src.drag_source_get_target_list() or Gtk.TargetList.new()
for t in targets:

if t[0] == target.name:

if t[1] & Gtk.TargetFlags.SAME_WIDGET:
target = None

break
res, info = targets.find(atom)
if res and info & Gtk.TargetFlags.SAME_WIDGET:
target = None

return target

Expand Down

0 comments on commit 4179700

Please sign in to comment.