Gazebo | Ignition | Community
Ask Your Question

Basic GUIPlugin causes Gazebo Client to segfault when exiting, why?

asked 2016-10-14 11:01:19 -0500

pDotGetName gravatar image

updated 2016-10-14 11:50:14 -0500


I implemented a GUIPlugin based on this tutorial:

I added some buttons and implemented the callback functions and it did what it was supposed to do, but whenever I close the client, I encounter a segmentation fault. (It's not the server, but the client.) I tried tracking down the cause for this and basically ended up removing every line of actual code and the segmentation fault still appears.

This is my GUIPlugin:


#include "PROJECT_NAME/ScenarioPlugin.h"

using namespace gazebo;

// Register this plugin with the simulator

// Constructor
ScenarioPlugin::ScenarioPlugin() {}

// Destructor
ScenarioPlugin::~ScenarioPlugin() {}


#include <gazebo/common/Plugin.hh>
#include <gazebo/gui/GuiPlugin.hh>
#ifndef Q_MOC_RUN  // See:
# include <gazebo/transport/transport.hh>
# include <gazebo/gui/gui.hh>

namespace gazebo
class GAZEBO_VISIBLE ScenarioPlugin : public GUIPlugin

  /// \brief Constructor
  /// \brief Destructor
  virtual ~ScenarioPlugin();
} // namespace gazebo

This is the corresponding passage in the CMakeLists.txt:

QT4_WRAP_CPP(headers_MOC include/${PROJECT_NAME}/ScenarioPlugin.h)
add_library(ScenarioPlugin SHARED ${headers_MOC} src/ScenarioPlugin.cpp)
target_link_libraries(ScenarioPlugin ${GAZEBO_LIBRARIES} ${QT_LIBRARIES} ${PROTOBUF_LIBRARIES})

and here how the plugin is used in the .world file:

<world name='default'>
      <plugin name='scenario_plugin' filename=''/>

The client starts normally and then shows a black frame at the top right corner of the word view. If the client is then closed, it segfaults. What causes this error? What do I have to do to close the plugin gracefully? GDB gives me the following backtrace:

#0  0x0000000000000020 in ?? ()
#1  0x00007ffff7735abe in ?? () from /usr/lib/x86_64-linux-gnu/
#2  0x00007ffff7752dbc in gazebo::gui::RenderWidget::~RenderWidget() () from /usr/lib/x86_64-linux-gnu/
#3  0x00007ffff7752e69 in gazebo::gui::RenderWidget::~RenderWidget() () from /usr/lib/x86_64-linux-gnu/
#4  0x00007ffff7781fc4 in gazebo::gui::MainWindow::closeEvent(QCloseEvent*) () from /usr/lib/x86_64-linux-gnu/
#5  0x00007ffff3cd8116 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/
#6  0x00007ffff4092a33 in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/
#7  0x00007ffff3c88e2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/
#8  0x00007ffff3c8f4a0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/
#9  0x00007ffff73354dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/
#10 0x00007ffff3cd4989 in QWidgetPrivate::close_helper(QWidgetPrivate::CloseMode) () from /usr/lib/x86_64-linux-gnu/
#11 0x00007ffff3cf30b2 in QApplication::x11ClientMessage(QWidget*, _XEvent*, bool) () from /usr/lib/x86_64-linux-gnu/
#12 0x00007ffff3d02892 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/
#13 0x00007ffff3d2ab32 in ?? () from /usr/lib/x86_64-linux-gnu/
#14 0x00007ffff1bebe04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/
#15 0x00007ffff1bec048 in ?? () from /lib/x86_64-linux-gnu/
#16 0x00007ffff1bec0ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/
#17 0x00007ffff73627a1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/
#18 0x00007ffff3d2abe6 in ?? () from /usr/lib/x86_64-linux-gnu/
#19 0x00007ffff73340af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/ ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-15 00:00:33 -0500

VehS gravatar image


we are also experiencing this issue, this seems quite bothersome, because gzserver then is not been killed. Are there any suggestions?

Best regards!

edit flag offensive delete link more

Question Tools



Asked: 2016-10-14 11:01:19 -0500

Seen: 463 times

Last updated: Oct 15 '16