Skip to content

Commit

Permalink
GafferUI : Fix crashes during shutdown
Browse files Browse the repository at this point in the history
All these signals get connected to by Python functions, so will contain slots with a `PyObject *` in them. But Python shuts down _before_ static destructors are run, after which we can't delete the PyObject. The solution is one we've used elsewhere : just "leak" the signal and its connected slots. It's intended to live for the entire lifetime of the app anyway, so it doesn't matter if it's not cleaned up during shutdown.
  • Loading branch information
johnhaddon committed Mar 21, 2024
1 parent c02ce07 commit fff4bda
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Fixes
- ImageGadget :
- Fixed loading of 2 channel images [^1].
- Fixed error message to include filename [^1].
- GUI : Fixed potential crashes during shutdown [^1].

API
---
Expand Down
8 changes: 4 additions & 4 deletions src/GafferUI/PlugAdder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ void PlugAdder::updateDragEndPoint( const Imath::V3f position, const Imath::V3f

PlugAdder::PlugMenuSignal &PlugAdder::plugMenuSignal()
{
static PlugMenuSignal s;
return s;
static PlugMenuSignal *s = new PlugMenuSignal;
return *s;
}

PlugAdder::MenuSignal &PlugAdder::menuSignal()
{
static MenuSignal s;
return s;
static MenuSignal *s = new MenuSignal;
return *s;
}

void PlugAdder::renderLayer( Layer layer, const Style *style, RenderReason reason ) const
Expand Down
4 changes: 2 additions & 2 deletions src/GafferUI/Pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ void Pointer::registerPointer( const std::string &name, ConstPointerPtr pointer

Pointer::ChangedSignal &Pointer::changedSignal()
{
static ChangedSignal s;
return s;
static ChangedSignal *s = new ChangedSignal;
return *s;
}

0 comments on commit fff4bda

Please sign in to comment.