File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,21 @@ EntityComponentManager::EntityComponentManager()
285
285
}
286
286
287
287
// ////////////////////////////////////////////////
288
- EntityComponentManager::~EntityComponentManager () = default ;
288
+ EntityComponentManager::~EntityComponentManager ()
289
+ {
290
+ // Views created in plugins have their destructor defined in the plugin that
291
+ // created the view. If a plugin has been unloaded early, trying to delete
292
+ // these views when destroying the ECM causes a segfault.
293
+ // To avoid a crash on shutdown for now, unique pointers to views are released
294
+ // so that view's destructors are not automatically called when the ECM is
295
+ // destroyed.
296
+ // (see https://github.com/ignitionrobotics/ign-gazebo/issues/1158
297
+ // for more info about why this may happen)
298
+ // TODO(adlarkin) find a better way to resolve this issue; possible solution
299
+ // in https://github.com/ignitionrobotics/ign-gazebo/pull/1317
300
+ for (auto &v : this ->dataPtr ->views )
301
+ v.second .first .release ();
302
+ }
289
303
290
304
// ////////////////////////////////////////////////
291
305
size_t EntityComponentManager::EntityCount () const
You can’t perform that action at this time.
0 commit comments