Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Invoking GUI plugins with -g causes QT error #1311

Closed
osrf-migration opened this issue Oct 24, 2014 · 10 comments
Closed

Invoking GUI plugins with -g causes QT error #1311

osrf-migration opened this issue Oct 24, 2014 · 10 comments
Labels
all bug Something isn't working gui minor

Comments

@osrf-migration
Copy link

Original report (archived issue) by Jackie K (Bitbucket: jacquelinekay).


On branch default, if I try to invoke a GUIPlugin with gazebo -g lib.so, Gazebo doesn't start and I get the error:

"QWidget: Must construct a QApplication before a QPaintDevice"

One can still load a GUI plugin by editing gui.ini, which is why this has been classified as minor, not major.

Plugins where this error occurs:
examples/plugins/gui_overlay_plugin_time
examples/plugins/gui_overlay_plugin_spawn
(in branch haptix_teleop_ux_test) plugins/GUIAratPlugin

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


What if you open gzserver and gzclient in separate terminals? Then gzclient -g lib__.so

Does that work?

@osrf-migration
Copy link
Author

Original comment by Jackie K (Bitbucket: jacquelinekay).


Nope.

@osrf-migration
Copy link
Author

Original comment by Jackie K (Bitbucket: jacquelinekay).


  • changed title from "Invoking GUI plugins with -g does not work" to "Invoking GUI plugins with -g causes QT error"

@osrf-migration
Copy link
Author

Original comment by Jackie K (Bitbucket: jacquelinekay).


  • Edited issue description

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


I can confirm the failure:

$ hg up default
$ cd examples/plugins/gui_overlay_plugin_time
$ mkdir build
$ cd build
$ cmake ..
$ make
$ gzserver &
$ GAZEBO_PLUGIN_PATH=$PWD && gdb gzclient
...
(gdb) r --verbose -g $PWD/libgui_example_time_widget.so
...
Gazebo multi-robot simulator, version 4.0.2
Copyright (C) 2012-2014 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

QWidget: Must construct a QApplication before a QPaintDevice

Program received signal SIGABRT, Aborted.
0x00007ffff318fbb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff318fbb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff3192fc8 in __GI_abort () at abort.c:89
#2  0x00007ffff567ec92 in qt_message_output(QtMsgType, char const*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007ffff567eff9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff567f804 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007ffff5cfed56 in QWidgetPrivate::QWidgetPrivate(int) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#6  0x00007ffff5d0d95d in QWidget::QWidget(QWidget*, QFlags<Qt::WindowType>) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#7  0x00007fffd73b8659 in gazebo::GUIPlugin::GUIPlugin() ()
   from examples/plugins/gui_overlay_plugin_time/build/libgui_example_time_widget.so
#8  0x00007fffd73b6a1a in gazebo::GUIExampleTimeWidget::GUIExampleTimeWidget() ()
   from examples/plugins/gui_overlay_plugin_time/build/libgui_example_time_widget.so
#9  0x00007fffd73b69d0 in RegisterPlugin ()
   from examples/plugins/gui_overlay_plugin_time/build/libgui_example_time_widget.so
#10 0x00007ffff67d5666 in gazebo::PluginT<gazebo::SystemPlugin>::Create (_filename=..., _name=...)
    at gazebo/common/Plugin.hh:168
#11 0x00007ffff67d46c3 in gazebo::addPlugin (_filename=...)
    at gazebo/gazebo.cc:99
#12 0x00000000004710d8 in parse_args (_argc=_argc@entry=4, _argv=_argv@entry=0x7fffffffd8e8)
    at gazebo/gui/GuiIface.cc:123
#13 0x0000000000471aa9 in gazebo::gui::run (_argc=4, _argv=0x7fffffffd8e8)
    at gazebo/gui/GuiIface.cc:252
#14 0x000000000044b6d9 in main (_argc=<optimized out>, _argv=<optimized out>)
    at gazebo/gui/main.cc:23
(gdb) 

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


  • set component to "gui"

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


@iche033

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • set version to "all"

@osrf-migration
Copy link
Author

Original comment by Jennifer Buehler (Bitbucket: JenniferBuehler).


I'm just looking at this too because that would be useful.

Though noticed that it wouldn't work anyway as gazebo_shared::addPlugin() only takes plugins of type SYSTEM_PLUGIN.
Aside from that, the gazebo_shared::setup() function is made for system plugins only and calls Load(argc,argv) and Init(argc,argv), which the
GUIPlugin doesn't have.

So I am guessing that the code to load the gui plugins from gazebo_client.cc is a remnant from previous versions.

The error happens because QApplication has to be created before the plugin, but the plugin is created from parse_args() in GuiIface.cc.

I created a pull request #2562 for this.

@osrf-migration
Copy link
Author

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


  • changed state from "new" to "resolved"

Merged in JenniferBuehler/gazebo/gzclient_gui_plugin_loading (pull request #2562)

Load GUI Plugins with gzclient parameter -g, fixes issue 1311

→ <<cset 599f776>>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
all bug Something isn't working gui minor
Projects
None yet
Development

No branches or pull requests

1 participant