Skip to content

Memory leak with FlowScene #151

@Quincunx271

Description

@Quincunx271

Currently, if you aren't careful, it's really easy to leak memory with FlowScene. ~FlowScene() isn't called by default. You have to write scene->setParent(parentWidget), otherwise it's not automatically deleted.

A possible fix would be to modify the constructor of FlowScene to something like this:

  FlowScene(std::shared_ptr<DataModelRegistry> registry =
              std::make_shared<DataModelRegistry>(),
            QWidget* parent = nullptr);
FlowScene::
FlowScene(std::shared_ptr<DataModelRegistry> registry, QWidget* parent)
  : _registry(registry)
{
  setItemIndexMethod(QGraphicsScene::NoIndex);
  setParent(parent);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions