mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
Fix GstAmcSurfaceTexture segfault
Check that `self` and `self->callback` are defined. `self` can be set to `NULL` in `remove_listener`, and `self->callback` can be set to `NULL` inside `gst_amc_surface_texture_jni_set_on_frame_available_callback`. This can cause a segfault since the Java object can outlive the C object, and call the callback after `remove_listener` is called. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3056>
This commit is contained in:
parent
2a4f96861e
commit
b91c2c1c65
1 changed files with 2 additions and 0 deletions
|
@ -243,6 +243,8 @@ on_frame_available_cb (JNIEnv * env, jobject thiz,
|
|||
long long context, jobject surfaceTexture)
|
||||
{
|
||||
GstAmcSurfaceTextureJNI *self = JLONG_TO_GPOINTER (context);
|
||||
if (!self || !self->callback)
|
||||
return;
|
||||
|
||||
self->callback (GST_AMC_SURFACE_TEXTURE (self), self->user_data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue