Skip to content

Regression: Crash when generating random network over an existing loaded network #231

@oxy86

Description

@oxy86

SocNetV crashes with EXC_BAD_ACCESS when the user generates a random network (e.g. Erdős–Rényi) while another network is already loaded and the "save before closing?" dialog is shown.


Steps to reproduce

  1. Load any network file
  2. Go to Network → Generate Random → Erdős–Rényi
  3. When asked "Network has not been saved. Do you want to save before closing?", click No
  4. Crash

Expected behavior

The existing network is cleared, the new random network is generated and displayed normally.


Crash location

GraphicsNode::addOutEdge(this=0x0)
  ← GraphicsEdge::GraphicsEdge (from=0x0, to=0x0)
    ← GraphicsWidget::drawEdge
      ← GraphicsWidget::setEdgeVisibility
        ← slotNetworkRandomErdosRenyiDialog (mainwindow.cpp:8463)

Root cause: During scene teardown of the old network, one or more GraphicsNode pointers become null/dangling before the new network's edges are drawn. GraphicsWidget::drawEdge then constructs a GraphicsEdge with a null from/to node, causing GraphicsNode::addOutEdge to dereference a null this pointer.


Environment

  • macOS arm64
  • Build: Debug

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions