mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-12 01:06:46 -04:00
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_clicked passes an obs_context_data pointer, and then passes the data pointer of that obs_context_data 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_properties you can actually get an obs_properties_t that 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_button v1 needs to go. obs_properties_add_button2 can 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_clicked should be replaced with a variant that doesn't take a second argument, as that argument will no longer be used anywhere.