Closed kezhuw closed 4 years ago
Thanks! Will review ASAP.
Not sure if the changes to the lowlevel mappings are required here?! You're also changing the version of Natives.initializer
in use - potentially to the correct one.
The old invocation of Native.initializer(ptr, false, false)
is where memory leak introduced. Following code creates a not owned promise in java.
Promise promise = new Promise(new Promise.PROMISE_CHANGE() {
@Override
public void onChange(Promise promise) {
}
});
GstPromise * gst_promise_new_with_change_func (GstPromiseChangeFunc func, gpointer user_data, GDestroyNotify notify)
has two additional parameters, while its java corresponding GstPromiseAPI.gst_promise_new_with_change_func
doesn't. When we construct promise using java version, we pass only one argument, C version got random user_data
, notify
from registers or stacks. Thus in gst_promise_free
we may got SIGBUS
or SIGSEGV
due to random notify
.
Current version got no coredump due to memory leak, aka. no gst_promise_free
at all.
Synchronize signatures of
GstPromiseAPI.gst_promise_new_with_change_func
andGstPromiseAPI.ptr_gst_promise_new_with_change_func
to C's version, so that it would not get unknownuser_data
andnotify
, otherwise we will get coredump ingst_promise_free
.