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

blender crash - Win32 Error# (6): The handle is invalid. #21

Closed
hannesdelbeke opened this issue Jul 1, 2022 · 1 comment
Closed

blender crash - Win32 Error# (6): The handle is invalid. #21

hannesdelbeke opened this issue Jul 1, 2022 · 1 comment

Comments

@hannesdelbeke
Copy link
Collaborator

hannesdelbeke commented Jul 1, 2022

blender crashes when running

import bqt 
from bqt import hello_world
bqt.register()
bqt.instantiate_application()  # <== crash here

upon investigation it happens during the init of BlenderApplication()
blender crashes on this line in bqt/blender_applications/blender_application.py

self._blender_window = QWindow.fromWinId(self._hwnd)
self.blender_widget = QWidget.createWindowContainer(self._blender_window)  # crashes here

the error thrown is
Win32 Error# (6): The handle is invalid.

@hannesdelbeke
Copy link
Collaborator Author

turns out it crashes because we dont store the qt window.
so python garbage collects it as soon as the script ends
since blender is parented to this window, blender also closes.

fix to this is to save the variable in blender.
by running a startup script. bqt_startup.py (which is not yet in this repo, but is included in the pip package)

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

No branches or pull requests

1 participant