Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access violation fix #44

Merged
merged 12 commits into from
Oct 7, 2022

Conversation

hannesdelbeke
Copy link
Collaborator

@hannesdelbeke hannesdelbeke commented Oct 7, 2022

this PR addresses an issue with access violation mentioned in PR #42
there is also some logic cleanup, since some funtions are called multiple times or in wrong places.

details:

QApplication is instanced, and a reference is saved in a variable in the QOperator.
the blender window is wrapped in QT, and is now managed by pyside/ the QApplication

when closing blender, operators likely get deregistered, which means the reference to QApplication is gone, and QApplication gets garbage collected.
but blender is managed by the QApp, which tries to delete all it's widgets etc.

since the operator owns qapp, qapp owns blender, and blender owns the operator. we have a loop.

moving the qapp to a global variable instead of the operator seems to fix the access violation error :D

notes
the specific commit that fixes the violation is the removal of the qoperator. replacing it with just a function

@hannesdelbeke
Copy link
Collaborator Author

approved by Frieder in slack

@hannesdelbeke hannesdelbeke merged commit e23b0dd into techartorg:master Oct 7, 2022
@hannesdelbeke hannesdelbeke deleted the access-violation-fix branch October 7, 2022 19:05
@hannesdelbeke
Copy link
Collaborator Author

hmm on further testing this has an issue.
it works all nicely, no exception on closing.

but if you launch a qt window, you get a different error on closing now
Error: Not freed memory blocks: 4, total unfreed memory 0.000351 MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant