jopohl / urh

Universal Radio Hacker: Investigate Wireless Protocols Like A Boss
GNU General Public License v3.0
10.99k stars 874 forks source link

crash when modifying existing selection in 'Interpretation' view #937

Closed nospam2000 closed 2 years ago

nospam2000 commented 2 years ago
Expected Behavior

Selection can be modified without a crash

Actual Behavior

urh crashes when modifying an existing selection in 'Interpretation' view

Steps To Reproduce
  1. Go to 'Interpretation' tab
  2. Select a rectangular area of the signal
  3. Try to grab the right border of the selection and move it to the left
  4. See error under 'Screenshots'
Screenshots

Error message:

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/urh/ui/views/SelectableGraphicView.py", line 184, in mouseMoveEvent
    start = QPoint(self.selection_area.x, self.selection_area.y)
TypeError: arguments did not match any overloaded call:
  QPoint(): too many arguments
  QPoint(int, int): argument 1 has unexpected type 'float'
  QPoint(QPoint): argument 1 has unexpected type 'float'
Platform Specifications
OS: macOS 11.6.3 with macports
XCode: 13.2.1 (including CLI tools)
URH version: urh-2.9.2.tar.gz
Python version: 3.10 installed with macports
pyqt5: py310-pyqt5 @5.15.6
bladeRF: @20211028-5a146b2a installed with macports
urh installed via: sudo -H BLADERF_API_VERSION=2.41 SDRPLAY_API_VERSION=2.13 pip-3.10 install urh
Possible fix

cast the coordinates from float to int type in ui/views/SelectableGraphicView.py" line 184 (in mouseMoveEvent)

--- /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/urh/ui/views/SelectableGraphicView.py.orig    2022-02-19 00:22:08.000000000 +0100
+++ /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/urh/ui/views/SelectableGraphicView.py 2022-02-19 00:21:41.000000000 +0100
@@ -181,7 +181,7 @@
                 return

             if self.selection_area.selected_edge == 1:
-                start = QPoint(self.selection_area.x, self.selection_area.y)
+                start = QPoint(int(self.selection_area.x), int(self.selection_area.y))
                 end = self.mapToScene(event.pos())

                 self.__set_selection_area(w=end.x() - start.x(), h=end.y() - start.y())