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

Not freed memory blocks on blender close #47

Open
hannesdelbeke opened this issue Oct 7, 2022 · 7 comments
Open

Not freed memory blocks on blender close #47

hannesdelbeke opened this issue Oct 7, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@hannesdelbeke
Copy link
Collaborator

hannesdelbeke commented Oct 7, 2022

after mergin in PR #44 to fix the access violation exception,
the following error happens on quiting blender, but only if a qt window was launched in blender
Error: Not freed memory blocks: 4, total unfreed memory 0.000351 MB

Originally posted by @hannesdelbeke in #44 (comment)

@hannesdelbeke
Copy link
Collaborator Author

hannesdelbeke commented Oct 8, 2022

this only happens if the qt window was parented to the blender_widget in qapp. no generic repro yet for mem not freed error

a default qdialog however doesn't do this when run in the blender terminal:
e.g. closing blender after running the following doesn't cause the error.

import PySide2
import PySide2.QtWidgets
import PySide2.QtWidgets as w
d = w.QDialog()
d.show()

@hannesdelbeke
Copy link
Collaborator Author

hannesdelbeke commented Oct 8, 2022

closing blender after running the following cause an acces violation exception
this is a different issue, but likely related

import PySide2
import PySide2.QtWidgets
import PySide2.QtWidgets as w

from PySide2.QtWidgets import QApplication
app = QApplication.instance()
bw = app.blender_widget

#d = w.QDialog() # this is fine
d = w.QDialog(bw) # acces violation on exit
d.show()
# close blender now without closing the widget

@ewerybody
Copy link

We had something like

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFA973DC23C
Module  : python310.dll
Thread  : 000053cc

on blender close with PySide2 5.15.2.1. I now just tried it all with PySide6. Works! 🚀

@hannesdelbeke
Copy link
Collaborator Author

Great to hear pyside6 fixed this ☺️

AFAIK this exception with pyside 2 doesnt cause issues since it only happens on closing blender, after executing any scripts hooked to exit.

Qt does mention any wrapping of a non qt window in a qt window is possible but not officially supported. So bugs like these are possible

@hannesdelbeke hannesdelbeke reopened this Dec 28, 2022
@hannesdelbeke hannesdelbeke added the bug Something isn't working label Dec 28, 2022
@hannesdelbeke
Copy link
Collaborator Author

hannesdelbeke commented Jun 5, 2023

this bug prevented qt from saving the window position and size to restore in the next session.
window code was changed to work around this #76

@hannesdelbeke
Copy link
Collaborator Author

weirdly enough this still happens when bqt is set to no wrap mode, investigate. ...
this might be good news, meaning the issue is not related to some of the window wrapping

@hannesdelbeke
Copy link
Collaborator Author

We recommend that you connect clean-up code to the aboutToQuit() signal, instead of putting it in your application's main() function. This is because, on some platforms the QApplication::exec() call may not return. For example, on the Windows platform, when the user logs off, the system terminates the process after Qt closes all top-level windows. Hence, there is no guarantee that the application will have time to exit its event loop and execute code at the end of the main() function, after the QApplication::exec() call.

source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants