Skip to content

Crash when adding a light to a model in Component Inspector Editor #3131

@XINJIANGMO

Description

@XINJIANGMO

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build?
    source , gz-sim10

Description

  • Expected behavior: gazebo doesn't crash and add light a the selected model.
  • Actual behavior: gazebo crashes

Steps to reproduce

  1. gz sim shapes.sdf
  2. open Component Inspector Editor plugin
  3. select a model and click add a link or light to a model and select one of value in light type
  4. crash

Output

Stack trace (most recent call last):
#31   Source "/usr/include/c++/13/bits/std_function.h", line 290, in _M_invoke [0x653bba49cf0c]
        287:       static _Res
        288:       _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args)
        289:       {
      > 290: 	return std::__invoke_r<_Res>(*_Base::_M_get_pointer(__functor),
        291: 				     std::forward<_ArgTypes>(__args)...);
        292:       }
#30   Source "/usr/include/c++/13/bits/invoke.h", line 111, in __invoke_r<void, addGuiFlags(CLI::App&)::<lambda()>&> [0x653bba49d74b]
        108:       using __type = typename __result::type;
        109:       using __tag = typename __result::__invoke_type;
        110:       if constexpr (is_void_v<_Res>)
      > 111: 	std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
        112: 					std::forward<_Args>(__args)...);
        113:       else
        114: 	return std::__invoke_impl<__type>(__tag{},
#29   Source "/usr/include/c++/13/bits/invoke.h", line 61, in __invoke_impl<void, addGuiFlags(CLI::App&)::<lambda()>&> [0x653bba49df3c]
         58:   template<typename _Res, typename _Fn, typename... _Args>
         59:     constexpr _Res
         60:     __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args)
      >  61:     { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
         62: 
         63:   template<typename _Res, typename _MemFun, typename _Tp, typename... _Args>
         64:     constexpr _Res
#28   Source "/home/momo/gz_jetty/src/gz-sim/src/cmd/gui_main.cc", line 91, in operator() [0x653bba49ae9b]
         88:       opt->waitGui = std::stoi(waitGui);
         89:     }
         90: 
      >  91:     runGui(opt->guiConfig.c_str(), opt->file.c_str(), opt->waitGui,
         92:            opt->renderEngineGui.c_str(),
         93:            opt->renderEngineGuiApiBackend.c_str());
         94:   });
#27   Source "/home/momo/gz_jetty/src/gz-sim/src/cmd/gz.cc", line 536, in runGui [0x653bba57ebdb]
        533:   };
        534:   int argc = sizeof(argv) / sizeof(argv[0]);
        535: 
      > 536:   return gz::sim::gui::runGui(argc, argv, _guiConfig, _file, _waitGui,
        537:                               _renderEngine, _renderEngineGuiApiBackend);
        538: }
        539: #endif
#26   Source "/home/momo/gz_jetty/src/gz-sim/src/gui/Gui.cc", line 666, in runGui [0x7a19a24265e2]
        663:   {
        664:     // Run main window.
        665:     // This blocks until the window is closed or we receive a SIGINT
      > 666:     app->exec();
        667:     gzdbg << "Shutting down gz-sim-gui" << std::endl;
        668:     return 0;
        669:   }
#25   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c33b35d, in QCoreApplication::exec()
#24   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c3429a2, in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
#23   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c5315ee, in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
#22   Source "../../../glib/gmain.c", line 4282, in g_main_context_iteration [0x7a199c113a52]
#21 | Source "../../../glib/gmain.c", line 4217, in g_main_context_dispatch_unlocked
      Source "../../../glib/gmain.c", line 4152, in g_main_context_iterate_unlocked [0x7a199c173716]
#20   Source "../../../glib/gmain.c", line 3344, in g_main_dispatch [0x7a199c1145b4]
#19   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c533a28, in 
#18   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c47b7aa, in QTimerInfoList::activateTimers()
#17   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c338447, in QCoreApplication::notifyInternal2(QObject*, QEvent*)
#16   Object "/usr/lib/x86_64-linux-gnu/libQt6Widgets.so.6.4.2", at 0x7a1999f8b3af, in QApplicationPrivate::notify_helper(QObject*, QEvent*)
#15   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c376575, in QObject::event(QEvent*)
#14   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c38ed6c, in QTimer::timeout(QTimer::QPrivateSignal)
#13   Object "/usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2", at 0x7a199c383d9a, in 
#12   Source "/usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h", line 383, in impl [0x7a19a2514f2d]
        380:                 delete static_cast<QSlotObject*>(this_);
        381:                 break;
        382:             case Call:
      > 383:                 FuncType::template call<Args, R>(static_cast<QSlotObject*>(this_)->function, static_cast<typename FuncType::Object *>(r), a);
        384:                 break;
        385:             case Compare:
        386:                 *ret = *reinterpret_cast<Func *>(a) == static_cast<QSlotObject*>(this_)->function;
#11   Source "/usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h", line 172, in call<QtPrivate::List<>, void> [0x7a19a251c47c]
        169:         enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true};
        170:         template <typename SignalArgs, typename R>
        171:         static void call(Function f, Obj *o, void **arg) {
      > 172:             FunctorCall<typename Indexes<ArgumentCount>::Value, SignalArgs, R, Function>::call(f, o, arg);
        173:         }
        174:     };
        175:     template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...) const>
#10   Source "/usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h", line 135, in call [0x7a19a252384d]
        132:         static void call(SlotRet (Obj::*f)(SlotArgs...), Obj *o, void **arg)
        133:         {
        134:             assertObjectType<Obj>(o);
      > 135:             (o->*f)((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]);
        136:         }
        137:     };
        138:     template <int... II, typename... SignalArgs, typename R, typename... SlotArgs, typename SlotRet, class Obj>
#9    Source "/home/momo/gz_jetty/src/gz-sim/src/gui/GuiRunner.cc", line 315, in UpdatePlugins [0x7a19a246fcfe]
        312:   auto plugins = gz::gui::App()->findChildren<GuiSystem *>();
        313:   for (auto plugin : plugins)
        314:   {
      > 315:     plugin->Update(this->dataPtr->updateInfo, this->dataPtr->ecm);
        316:   }
        317:   this->dataPtr->ecm.ClearRemovedComponents();
        318:   this->dataPtr->ecm.ClearNewlyCreatedEntities();
#8    Source "/home/momo/gz_jetty/src/gz-sim/src/gui/plugins/scene_manager/GzSceneManager.cc", line 139, in Update [0x7a197953a5a7]
        137:   std::lock_guard<std::mutex> lock(this->dataPtr->newRemovedEntityMutex);
        138:   {
      > 139:     this->dataPtr->renderUtil.CreateVisualsForEntities(_ecm,
        140:         this->dataPtr->newEntities);
        141:     this->dataPtr->newEntities.clear();
        142:   }
#7    Source "/home/momo/gz_jetty/src/gz-sim/src/rendering/RenderUtil.cc", line 3743, in CreateVisualsForEntities [0x7a1960f6525d]
       3740:     auto visualComp = _ecm.Component<components::Visual>(ent);
       3741:     if (visualComp)
       3742:     {
      >3743:       this->dataPtr->CreateVisual(_ecm, ent,
       3744:           _ecm.Component<components::Name>(ent),
       3745:           _ecm.Component<components::Pose>(ent),
       3746:           _ecm.Component<components::Geometry>(ent),
#6    Source "/home/momo/gz_jetty/src/gz-sim/src/rendering/RenderUtil.cc", line 3800, in CreateVisual [0x7a1960f65ae5]
       3797:   sdf::Visual visual;
       3798:   visual.SetName(_name->Data());
       3799:   visual.SetRawPose(_pose->Data());
      >3800:   visual.SetGeom(_geom->Data());
       3801:   visual.SetCastShadows(_castShadows->Data());
       3802:   visual.SetTransparency(_transparency->Data());
       3803:   visual.SetVisibilityFlags(_visibilityFlags->Data());
#5    Source "/home/momo/gz_jetty/src/sdformat/src/Visual.cc", line 240, in SetGeom [0x7a199f754129]
        237: /////////////////////////////////////////////////
        238: void Visual::SetGeom(const Geometry &_geom)
        239: {
      > 240:   this->dataPtr->geom = _geom;
        241: }
        242: 
        243: /////////////////////////////////////////////////
#4    Source "/home/momo/gz_jetty/install/include/gz/sdformat16/sdf/Geometry.hh", line 93, in operator= [0x7a19a128cf9a]
         90:   /// Type function to determine the type of shape contained within a
         91:   /// Geometry. Access to shape data, such as a box's size, is achieved
         92:   /// through the shape accessors, such as const Box *BoxShape() const.
      >  93:   class SDFORMAT_VISIBLE Geometry
         94:   {
         95:     /// \brief Default constructor
         96:     public: Geometry();
#3    Source "/home/momo/gz_jetty/install/include/gz/utils4/gz/utils/detail/ImplPtr.hh", line 70, in operator= [0x7a19a1296012]
         67:         const ImplPtr &_other) -> ImplPtr&
         68:     {
         69:       if (this->ptr)
      >  70:         this->ops.assign(*this->ptr, *_other.ptr);
         71:       else
         72:         this->ptr.reset(this->ops.construct(*_other.ptr));
#2    Source "/usr/include/c++/13/bits/unique_ptr.h", line 454, in operator* [0x7a19a25cbd0b]
        451:       operator*() const noexcept(noexcept(*std::declval<pointer>()))
        452:       {
        453: 	__glibcxx_assert(get() != pointer());
      > 454: 	return *get();
        455:       }
        456: 
        457:       /// Return the stored pointer.
#1    Source "/usr/include/c++/13/bits/unique_ptr.h", line 470, in get [0x7a19a25deb09]
        467:       _GLIBCXX23_CONSTEXPR
        468:       pointer
        469:       get() const noexcept
      > 470:       { return _M_t._M_ptr(); }
        471: 
        472:       /// Return a reference to the stored deleter.
        473:       _GLIBCXX23_CONSTEXPR
#0    Source "/usr/include/c++/13/bits/unique_ptr.h", line 199, in _M_ptr [0x7a19a25ee6cc]
        196:       _GLIBCXX23_CONSTEXPR
        197:       pointer&   _M_ptr() noexcept { return std::get<0>(_M_t); }
        198:       _GLIBCXX23_CONSTEXPR
      > 199:       pointer    _M_ptr() const noexcept { return std::get<0>(_M_t); }
        200:       _GLIBCXX23_CONSTEXPR
        201:       _Dp&       _M_deleter() noexcept { return std::get<1>(_M_t); }
        202:       _GLIBCXX23_CONSTEXPR
Segmentation fault (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions