obsproject / obs-browser

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

Fix issues with failed JSON parsing in JS API responses #391

Closed WizardCM closed 10 months ago

WizardCM commented 1 year ago

Description

Using a forum post as reference, overhauled JSON handling internally to use CefValue rather than the V8 context.

Note: It seems the V8 context is still required in this code block. I am unsure exactly why (it crashes otherwise).

Motivation and Context

When users call API functions, they expect a response. Especially a valid one. Fixes #390.

How Has This Been Tested?

obsstudio.getScenes and obsstudio.getCurrentScene with scene names that contain characters such as " and \.

Also re-tested all other get functions to make sure nothing else was broken.

Types of changes

Checklist:

WizardCM commented 1 year ago

Rebased on master (after fixing Nlohmann JSON compilation on Windows & macOS), removed unnecessary changes based on @tytan652's feedback, and retested with Nlohmann JSON specifically. It has the same output difference as json11 so this PR is still necessary to fix the linked issue.

Ready to be reviewed.