Skip to content

Access Violation code when deleting a node with a widget on it and closing the application #444

Open
@laurapons

Description

@laurapons

If I create a node with a widget on it (for example a combobox), delete the node and close the application, the code breaks with and access violation return code.
Run the snippet below:

import sys
from PySide2.QtWidgets import QApplication
from NodeGraphQt import BaseNode, NodeGraph


class CustomNode(BaseNode):
    __identifier__ = 'com.example'
    NODE_NAME = 'Custom Node'

    # region Constructor

    def __init__(self):
        super(CustomNode, self).__init__()
        self.add_input('Input')
        self.add_output('Output')
        self.add_combo_menu(name='DROPDOWN_ID', items=[], tooltip='tooltip')
        self._combobox = self.widgets()['DROPDOWN_ID'].get_custom_widget()


app = QApplication([])

# Create a graph
graph = NodeGraph()

# Add delete command to the context menu
context_menu = graph.get_context_menu('graph')
context_menu.add_command('&Delete', lambda: graph.delete_nodes(graph.selected_nodes()), 'QtGui.QKeySequence.Delete')

# Register the custom node
graph.register_node(CustomNode)
# Create an instance of the custom node and add it to the graph
graph.create_node('com.example.CustomNode', name=CustomNode.NODE_NAME)
# Create a window to display the graph
graph_widget = graph.widget
graph_widget.show()

# Start the application
sys.exit(app.exec_())

The error I get is:

Process finished with exit code -1073741819 (0xC0000005)

I use:
PySide2 5.15.2.1
NodeGraphQt 0.6.38

I tried debugging the dump file, but I could not find any trace of why it crashes (probably not deleting the Qt widgets properly?). I need help on this, I cannot use the application without being able to add any widget on the node and not crashing.

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