Skip to content

GLWidget.drawBackground crashes with GL stack overflow when drag leaves embedded panel #6966

@lucienfostier

Description

@lucienfostier

Version: 1.6.19.2-linux
Third-party tools: Nuke 15.1
Third-party modules: Custom panel embedding Gaffer ScriptWindow inside Nuke via QWidget

Description

_GLGraphicsScene.drawBackground in GLWidget.py crashes when a drag initiated inside the Gaffer node graph leaves the embedded Gaffer panel boundary. Exceptions raised during __backgroundDrawFunction()
prevent glPopAttrib/glPopClientAttrib from executing, leaking GL attribute pushes that accumulate until the stack overflows. This subsequently triggers re-entrant selection passes ("Another Selector is
already active"), crashing in native code with SIGSEGV.

The root cause is that drawBackground does not wrap __backgroundDrawFunction() in try/finally, so any exception skips the GL pop calls. A try/finally around the draw function would prevent the GL stack
accumulation. However, the re-entrant Selector issue ("Another Selector is already active") also needs investigation — the drag-leave path appears to trigger selection passes that re-enter native code
unsafely.

Steps to reproduce

  1. Embed a Gaffer ScriptWindow inside a host application panel (e.g. Nuke custom QWidget panel)
  2. Create nodes in the Gaffer node graph
  3. Start dragging a node in the node graph
  4. While holding the mouse button, move the cursor outside the Gaffer panel/window boundary
  5. Crash occurs

Debug log

Click to Expand

Traceback (most recent call last):
File ".../GafferUI/GLWidget.py", line 409, in drawBackground
GL.glPushAttrib( GL.GL_ALL_ATTRIB_BITS )
File ".../OpenGL/3.1.5/OpenGL/error.py", line 230, in glCheckError
raise self._errorClass(
OpenGL.error.GLError: GLError(
err = 1283,
description = b'stack overflow',
baseOperation = glPushAttrib,
cArguments = (GL_ALL_ATTRIB_BITS,)
)

ERROR : Emitting signal : ID shader does not have an ieCoreGLNameOut output
ERROR : Emitting signal : Another Selector is already active
ERROR : EventSignalCombiner : stack overflow
WARNING | signal caught: SIGSEGV -- Invalid memory reference
Segmentation fault

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions