GNOME Bugzilla – Bug 791423
videofilter: Should probably not change class property in set_caps()
Last modified: 2018-11-03 12:02:03 UTC
Just stumbled across some code that does not seem quite safe: gst_video_filter_set_caps(): + if (fclass->transform_frame_ip == NULL) + GST_BASE_TRANSFORM_CLASS (fclass)->transform_ip_on_passthrough = FALSE; This type of code is normally placed in a class init function I believe. I do expect a class to be generally immutable (except maybe for aa thread safe singleton). At least, I don't think it would be good practice to change the function pointer dynamically in an instance, or change these kind of property.
Especially it is actually not safe. Say you have class A inheriting from videofilter and then class B inheriting from class A, and class B actually defines a transform_ip. If class A is doing set_caps() before class B is initialized, transform_ip_on_passthrough is going to be set to FALSE, and that is then inherited by class B once it is initialized. If class B is initialized before class A is doing set_caps(), it would get the previous value of transform_ip_on_passthrough.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/405.