NatronGitHub / Natron

Open-source video compositing software. Node-graph based. Similar in functionalities to Adobe After Effects and Nuke by The Foundry.
http://NatronGitHub.github.io
GNU General Public License v2.0
4.54k stars 332 forks source link

Clear current GLX context before destroying the current context #867

Closed jix closed 1 year ago

jix commented 1 year ago

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.