GstVaapiObject: make gst_vaapi_object_new() more robust.

Forbid GstVaapiObject to be created without an associated klass spec.
It is mandatory that the subclass implements an adequate .finalize()
hook, so it shall provide a valid GstVaapiObjectClass.

https://bugzilla.gnome.org/show_bug.cgi?id=722757

[made non-NULL klass argument to gst_vaapi_object_new() a requirement]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Sreerenj Balachandran 2014-01-22 08:20:59 +02:00 committed by Gwenole Beauchesne
parent 502952d080
commit 99bf1b1f98

View file

@ -67,10 +67,8 @@ gst_vaapi_object_class_init(GstVaapiObjectClass *klass, guint size)
* @klass: The object class * @klass: The object class
* @display: The #GstVaapiDisplay * @display: The #GstVaapiDisplay
* *
* Creates a new #GstVaapiObject. If @klass is NULL, then the size of * Creates a new #GstVaapiObject. The @klass argument shall not be
* the allocated object is the same as sizeof(GstVaapiObject). * %NULL, and it must reference a statically allocated descriptor.
* If @klass is not NULL, typically when a sub-class is implemented,
* that pointer shall reference a statically allocated descriptor.
* *
* This function zero-initializes the derived object data. Also note * This function zero-initializes the derived object data. Also note
* that this is an internal function that shall not be used outside of * that this is an internal function that shall not be used outside of
@ -86,6 +84,7 @@ gst_vaapi_object_new(const GstVaapiObjectClass *klass, GstVaapiDisplay *display)
GstVaapiObject *object; GstVaapiObject *object;
guint sub_size; guint sub_size;
g_return_val_if_fail(klass != NULL, NULL);
g_return_val_if_fail(display != NULL, NULL); g_return_val_if_fail(display != NULL, NULL);
object = (GstVaapiObject *)gst_vaapi_mini_object_new(object_class); object = (GstVaapiObject *)gst_vaapi_mini_object_new(object_class);