[x] I've formatted my code according to Natron's code style
[x] I've searched the pull requests tracker to ensure that this PR is not a duplicate
PR Description
What type of PR is this? (Check one of the boxes below)
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Improvement (non-breaking change which does not add functionality nor fixes a bug but improves Natron in some way)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] My change requires a change to the documentation
[ ] I have updated the documentation accordingly
What does this pull request do?
On Linux systems using GLX, it clears the current GLX context before destroying the current context, which fixes a crash-on-startup on my system (Arch Linux, Qt 5.15.8, using an NVIDIA GPU with vendor drivers).
Have you tested your changes (if applicable)? If so, how?
I only tested it as far as that Natron doesn't crash right away anymore. Since I don't know how to use Natron yet, not having gotten to the point where I can try it before having fixed this, I haven't really performed more testing. Since I found others being affected by the same bug (#863) I wanted to share my potential fix rather sooner than later.
Futher details of this pull request
Without this, on my system, Qt somehow ends up using a GLX context that Natron already destroyed, causing a GLXBadContext crash on startup. That much I verified using GDB. I have no idea how Qt ends up using that context at all and how it ends up using it at that point. I assume it just uses the current context and somehow ends up getting a destroyed context when querying the current context, but that's just a guess based on this fix working for me.
I have no clue who of Natron, Qt or NVIDIA's GLX implementation are at really at fault, nor have I tested this beyond verifying that Natron doesn't crash on startup anymore.
PR Description
What type of PR is this? (Check one of the boxes below)
What does this pull request do?
On Linux systems using GLX, it clears the current GLX context before destroying the current context, which fixes a crash-on-startup on my system (Arch Linux, Qt 5.15.8, using an NVIDIA GPU with vendor drivers).
Have you tested your changes (if applicable)? If so, how?
I only tested it as far as that Natron doesn't crash right away anymore. Since I don't know how to use Natron yet, not having gotten to the point where I can try it before having fixed this, I haven't really performed more testing. Since I found others being affected by the same bug (#863) I wanted to share my potential fix rather sooner than later.
Futher details of this pull request
Without this, on my system, Qt somehow ends up using a GLX context that Natron already destroyed, causing a GLXBadContext crash on startup. That much I verified using GDB. I have no idea how Qt ends up using that context at all and how it ends up using it at that point. I assume it just uses the current context and somehow ends up getting a destroyed context when querying the current context, but that's just a guess based on this fix working for me.
I have no clue who of Natron, Qt or NVIDIA's GLX implementation are at really at fault, nor have I tested this beyond verifying that Natron doesn't crash on startup anymore.