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
Reparenting windows fails if the original parent is dead. #1064
Comments
This is a general problem with the QWidget wrapping mechanism - if you want to keep a child after a parent has died, you need to remove it from the parent before the parent dies. When the parent dies on the C++ side, it deletes all the children recursively. If you remove the child first, the python wrappers reassume ownership of the C++ child instance, and when the parent dies it doesn't delete the child, because it's not a child any more. Qt doesn't use smart pointers for shared ownership like we do in Gaffer/Cortex, so this behaviour is counterintuitive compared to the rest of our APIs, and a case where our UI abstraction on top of Qt is leaky. It might be worth investigating whether or not we can remove the children automatically from a For this specific case, the preferences window in ApplicationMenu.py provides a working example - it only keeps weak references to the preferences window, so if the window is destroyed by a parent ScriptWindow, it will get created again. |
Actually, is there a reason we need to parent the |
Does it stay on top if you go fullscreen? If it does I'll try the same on OS X to see if it works here too, but I'm pretty sure parenting was necessary to keep things on top in all scenarios. |
Yeah, even in full screen it goes on top |
Hmm - not on OS X, not even in non-fullscreen mode. I thought there was a reason things were the way they are. |
Ok, I've got a commit up in #1066 which uses |
To reproduce, open a script, launch the
DispatcherWindow
, close it, open a new script, close the firstScriptWindow
, then try to launch theDispatcherWindow
from your newScriptWindow
.The text was updated successfully, but these errors were encountered: