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

ErrorDialogue : Fix parentWindow lifetime issues #1986

Merged
merged 1 commit into from Feb 28, 2017

Conversation

johnhaddon
Copy link
Member

Because ErrorDialogue.ErrorHandler was deriving from IECore.MessageHandler, it was subject to garbage collection. When used from the FileMenu (and others), the parentWindow passed was a full blown ScriptWindow, which in turn became subject to garbage collection. Garbage collection can kick in at any time, and on any thread. This could lead to a ScriptWindow being destroyed on a non-gui thread, leading to the attempted destruction of QtOpenGL resources on the wrong thread, and therefore deadlocks and crashes.

We fix this by changing the ErrorHandler/MessageHandler relationship from "is a" to "has a", which is arguably what it should have been anyway, even without lifetime considerations.

Because ErrorDialogue.ErrorHandler was deriving from IECore.MessageHandler, it was subject to garbage collection. When used from the FileMenu (and others), the parentWindow passed was a full blown ScriptWindow, which in turn became subject to garbage collection. Garbage collection can kick in at any time, and on any thread. This could lead to a ScriptWindow being destroyed on a non-gui thread, leading to the attempted destruction of QtOpenGL resources on the wrong thread, and therefore deadlocks and crashes.

We fix this by changing the ErrorHandler/MessageHandler relationship from "is a" to "has a", which is arguably what it should have been anyway, even without lifetime considerations.
@andrewkaufman andrewkaufman merged commit 7ef3d44 into GafferHQ:master Feb 28, 2017
@johnhaddon johnhaddon deleted the scriptWindowLifetime branch March 1, 2017 15:19
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.

None yet

2 participants