Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when writing to IInteger node that defines range larger than int32 in Attribute Controller #32

Open
basfee opened this issue Jul 6, 2023 · 3 comments

Comments

@basfee
Copy link

basfee commented Jul 6, 2023

Describe the bug
When trying to write to an IInteger node that defines a range larger than int32 (via the Attribute Controller window), the GUI will crash as soon as you double click the field where the value is to be filled in. I found this in an Integer node that defines the following range:

        <Integer Name="x">
            <pValue>Reg_x</pValue>
            <Min>0</Min>
            <Max>4294967295</Max>
        </Integer>

The crash message is:

WARNING: Traceback (most recent call last):
  File "XXX/lib/python3.8/site-packages/harvesters_gui/_private/frontend/pyqt5/feature_tree.py", line 339, in createEditor
    w.setRange(feature.min, feature.max)
OverflowError: argument 2 overflowed: value must be in the range -2147483648 to 2147483647
Aborted (core dumped)

To Reproduce
Steps to reproduce the behavior:

  1. Start harvesters GUI, connect to a camera with an IInteger node with range > int32
  2. Open the Attribute Controller window
  3. Go to the troublesome IInteger node and double click the value, such that you can write your own value
  4. Crash on the double click (never get a chance to input a value)

Expected behavior
No crash, expecting compatibility with 64-bit int

Desktop:

  • OS: Ubuntu 20
  • Version: 1.3.8

Additional information
The problem is that the QSpinBox object used in the GUI is limited to int32: https://doc.qt.io/qt-5/qspinbox.html#maximum-prop but per the GenICam standard (I'm looking at v2.1.1) an integer node its range is 64-bits.

@cgraf78
Copy link

cgraf78 commented Jul 6, 2023

Hi, I happened to run into this crash also and have been using this commit as a fix.

Have been meaning to get a PR created for this, but just hadn't done it yet. I'm curious to know if this fixes the issues you're seeing. Thanks!

@basfee
Copy link
Author

basfee commented Jul 7, 2023

Hey. I have tested your changes and indeed they fix this issue! Wonderful.

Note: there are some differences though. Currently, the box refuses to have non-numeric characters in the box and it also doesn't allow setting the box empty (it keeps the previous value when the box is made empty and enter is pressed).

With the changes the harvesters-gui crashes instead for such cases, with:

WARNING: Traceback (most recent call last):
  File "XXX/lib/python3.8/site-packages/harvesters_gui/_private/frontend/pyqt5/feature_tree.py", line 400, in setModelData
    data = editor.value()
  File "XXX/lib/python3.8/site-packages/harvesters_gui/_private/frontend/pyqt5/big_int_spinbox.py", line 41, in value
    return int(self.lineEdit.text())
ValueError: invalid literal for int() with base 10: ''

@cgraf78
Copy link

cgraf78 commented Jul 8, 2023

Good news, progress! Thanks for testing.

Yeah, the changes in this commit are probably still a bit rough and need a bit more rigor. I'll try to look at the additional issues found with your testing... appreciate you flagging these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants