Skip to content

Commit

Permalink
OpenColorIOTransformBinding : Add missing ScopedGILRelease
Browse files Browse the repository at this point in the history
This was causing hangs when opening old Gaffer files in `1.3.x`, if the user's default layout was such that the Viewer would start a compute as soon as the file was opened. In this case, `acquireDefaultConfigPlug()` was still holding the GIL while creating the plug, and creating the plug would request cancellation of the compute, and the compute couldn't cancel if it was waiting for the GIL.
  • Loading branch information
johnhaddon committed Nov 3, 2023
1 parent f7b163c commit a3d2424
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Fixes
- Dispatch app : Removed unnecessary and misleading "Execute" button.
- SceneAlgo : Fixed computation of `ScenePlug.object` in networks with nodes derived from `ObjectProcessor`. These include : `CameraTweaks`, `ClosestPointSampler`, `CollectPrimitiveVariables`, `CopyPrimitiveVariables`, `CurveSampler`, `DeleteCurves`, `DeleteFaces`, `DeletePoints`, `MapOffset`, `MapProjection`, `MeshDistortion`, `MeshNormals`, `MeshSegments`, `MeshTangents`, `MeshToPoints`, `MeshType`, `Orientation`, `PointsType`, `PrimitiveSampler`, `PrimitiveVariables`, `ReverseWinding`, `ShufflePrimitiveVariables` and `UVSampler` (#5406).
- Metadata : Fixed redundant copying of metadata when promoting plugs.
- OpenColorIO : Fixed hang when opening a script which didn't yet have the `openColorIO.config` plug.

API
---
Expand Down
2 changes: 2 additions & 0 deletions include/GafferImage/OpenColorIOConfigPlug.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@ class GAFFERIMAGE_API OpenColorIOConfigPlug final : public Gaffer::ValuePlug
Gaffer::Signals::ScopedConnection m_plugSetConnection;
};

IE_CORE_DECLAREPTR( OpenColorIOConfigPlug );

} // namespace GafferImage
11 changes: 8 additions & 3 deletions src/GafferImageModule/OpenColorIOTransformBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ boost::python::list supportedExtensions()
return result;
}

OpenColorIOConfigPlugPtr acquireDefaultConfigPlugWrapper( Gaffer::ScriptNode &scriptNode, bool createIfNecessary )
{
IECorePython::ScopedGILRelease gilRelease;
return OpenColorIOConfigPlug::acquireDefaultConfigPlug( &scriptNode, createIfNecessary );
}

} // namespace

void GafferImageModule::bindOpenColorIOTransform()
Expand Down Expand Up @@ -121,9 +127,8 @@ void GafferImageModule::bindOpenColorIOTransform()
)
)
.def(
"acquireDefaultConfigPlug", &OpenColorIOConfigPlug::acquireDefaultConfigPlug,
( arg( "scriptNode" ), arg( "createIfNecessary" ) = true ),
boost::python::return_value_policy<IECorePython::CastToIntrusivePtr>()
"acquireDefaultConfigPlug", &acquireDefaultConfigPlugWrapper,
( arg( "scriptNode" ), arg( "createIfNecessary" ) = true )
)
.staticmethod( "acquireDefaultConfigPlug" )
;
Expand Down

0 comments on commit a3d2424

Please sign in to comment.