obsproject / obs-browser

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

Move browser-panel ObjC code to Objective-C file; Add more null checks #408

Closed gxalpha closed 1 year ago

gxalpha commented 1 year ago

Description

Moves the Objective-C calls in browser-panel.cpp into an actual Objective-C file, making it more readable. Also adds a !view null check in addition to the existing !*((bool *)view) which might fix a newly reported crash.

Motivation and Context

https://github.com/obsproject/obs-studio/issues/8836 was reported and maybe the first null check fixes it. I have no idea if it actually does since I can't reproduce the crash in the first place.

How Has This Been Tested?

macOS 13.3.1 Made sure that the crash of the original null check added in #374 didn't regress by using twitch integration with and without the call to RemoveNSViewFromSuperview. Whether or not the new crash is fixed I don't know, I guess we'll see when we deploy to production.

Types of changes

Checklist: