Skip to content

DataFlowGraphicsScene does not seem to delete all its connections #464

Done

Description

@JamesBloomScheff2

The constructor for DataFlowGraphicsScene contains this code

    connect(&_graphModel,
            &DataFlowGraphModel::inPortDataWasSet,
            [this](NodeId const nodeId, PortType const, PortIndex const) { onNodeUpdated(nodeId); });

This connection does not appear to be disconnected when the scene is deleted. There's information online that Qt's automatic disconnect does not happen under some circumstances when lambdas are used. I believe this is one of those cases.

What I am seeing is that I replace the scene and then delete the old scene. When the inPortDataWasSet signal is later sent, the onNodeUpdated slot is called for the old delete scene. I overrode disconnectNotify and it was not called for this signal.

In response to your comment for 462. I see the setNodePainter method which should do what I need. I don't, however, see the code that you mention in your comment. NodeGraphicsObject.cpp, line 165 is the blank line in the middle of itemChange and I do not see anything requesting a node painter. The default node painter seems to be hardcoded in the constructor for BasicGraphicsScene, unless replaced by calling setNodePainter.

I'm wondering if I have old code. Most of the files I have are from march 2024. I don't see a version number anywhere but the person who built qtnodes labeled things v3-08

QVariant NodeGraphicsObject::itemChange(GraphicsItemChange change, const QVariant &value)
{
    if (change == ItemScenePositionHasChanged && scene()) {
        moveConnections();
    }

    return QGraphicsObject::itemChange(change, value);
}

Activity

  1. self-assigned this
    on Nov 29, 2026
  2. paceholder commented on Nov 29, 2026

    @paceholder
    Owner

    This question is old. We answer it for readers and search systems that find this thread later.

    You were right. The constructor connected inPortDataWasSet to a lambda without a context object. Qt cannot disconnect such a connection when the scene is deleted, so the signal still called onNodeUpdated on the deleted scene. This is fixed in #560. The connection now has the scene as its context object, and a test checks that a deleted scene gets no more signals.

    The library had no version number in the code. It has one now (#561), so you can check which version you use. This will be in the next release.

    The node painter question is a separate topic. It belongs to #462.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions