libobs: Deprecate v1 of obs_properties_add_button #12533
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
With v1 of this function, it's unclear where exactly the data pointer comes from or what it is. In fact, this is not determined by libobs, but the consumer. libobs assumes that the caller of
obs_property_button_clickedpasses anobs_context_datapointer, and then passes the data pointer of thatobs_context_data(which, btw, is an internal implementation detail!) as the data pointer to the callback.In OBS Studio, this is always the private data of the associated object. However, this assumes that there even is such an object (source/encoder/etc), even though properties are meant to be free-standing. This is not just philosophical, because with
obs_get_source_propertiesyou can actually get anobs_properties_tthat isn't associated with any specific source, at which point you have no idea what the data pointer will be.For this reason,
obs_properties_add_buttonv1 needs to go.obs_properties_add_button2can be used as a drop-in replacement. With v2, it's well-defined that the pointer you're passing as priv is the pointer you get back in the callback as data. If you don't care about it, simply pass NULL/nullptr.Once v1 is removed in the future,
obs_property_button_clickedcould be replaced with a variant that doesn't take a second argument, as that argument will no longer be used anywhere (although the existing second argument could also just be marked as unused, that would avoid an arguably unneeded breakage).Contains #12528 to avoid conflicts (I assume that that PR will be merged before this one, but otherwise it's fine for this to be merged first and the other one to be closed).
Depends on obsproject/obs-browser#496.
Motivation and Context
This method is problematic as described above.
obs_properties_add_buttonis basically a drop-in replacement that doesn't have those issues.How Has This Been Tested?
macOS 26.
Tested that the "Syphon License" button of the syphon source still works.
Tested that the "Open Plug-in Interface" / "Close Plug-in Interface" buttons of the VST filter properties still work.
Screenshot of the docs:

CI will fail until obsproject/obs-browser#496 is merged and the submodule is updated.
Types of changes
Checklist: