obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
771 stars 218 forks source link

Null check macOS window handle before detaching view #374

Closed gxalpha closed 1 year ago

gxalpha commented 1 year ago

Description

Fixes a crash with service integrations. What the original code does is decoupling the browser from the widget (more explanation is in the comment a few lines above the modified). For some reason however, on Qt 6 the window handle can be null sometimes. In that case, trying to detach the view from the view from the superview fails (obviously).

By the way, the code looks cursed for two reasons: 1) It's Objective-C in a C(++) file 2) It was unreadable even before. If desired I can untangle the original code.

Motivation and Context

Don't want crashes.

How Has This Been Tested?

macOS 13. No more crashes with Twitch integration.

Types of changes

Checklist:

WizardCM commented 1 year ago

Also we can save untangling the code for post-28 in my opinion.