gazebosim / gz-gui

Builds on top of Qt to provide widgets which are useful when developing robotics applications, such as a 3D view, plots, dashboard, etc, and can be used together in a convenient unified interface.
https://gazebosim.org
Apache License 2.0
74 stars 43 forks source link

GzSpinBox causes the Qt Scene Graph to crash on macOS #542

Closed srmainwaring closed 7 months ago

srmainwaring commented 1 year ago

Environment

Description

Steps to reproduce

  1. Update and upgrade brew. This will install qt@5 5.15.8_3.
  2. Run gz sim -g shapes.sdf
  3. Open the Component Inspector (if not already opened)

Output

See https://github.com/gazebosim/gz-sim/issues/1987.

The problem appears to be a conflict between QtQuickControls 1.4 and QtQuickControls 2.2. Both versions have a SpinBox but the behaviour is very different. The version in QtQuickControls 2.2 is for integer values only.

The QML documentation suggests an approach to use the controls for floats, but it is badly flawed and will not work for the use cases needed in gz-sim. A reimplementation of a spin box for doubles is needed. Docs and discussion:

This is a serious bug on macOS as it causes an application crash on start up for any of the default examples (because the default gui.config includes the component inspector which indirectly loads the spin box).

Possible approach

One of the answers in the SO article suggests a replacement SpinBox supporting doubles. This is almost a drop-in replacement for GzSpinBox. The branches below make the modifications to gz-gui7 and gz-sim7:

azeey commented 1 year ago

@srmainwaring I just tested this on an Intel macOS running Monterey, but I'm not getting a segfault at all. The spinbox doesn't seem to work properly (it's blank), but it doesn't crash. qt@5 has been upgraded to 5.15.10. Can you give it another try?

srmainwaring commented 7 months ago

Can you give it another try?

@azeey - doing some book-keeping! Not seeing this at all in current Garden and Harmonic running Sonoma on M1 with latest brew - so suspect it was transient.