GNOME Bugzilla – Bug 797322
Callback being made on a garbage collected delegate of PromiseChangeFuncNative
Last modified: 2018-11-03 11:09:32 UTC
Created attachment 374005 [details] Code I'm basing on I'm using a slightly modified version of Centriculars WebRTCSendRecv example. When debugging, about 2/3 of the times, I'm getting the following exception: 'CallbackOnCollectedDelegate' : 'A callback was made on a garbage collected delegate of type 'gstreamer-sharp!GstSharp.PromiseChangeFuncNative::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.' It happens exactly when OnOfferCreated should be called back, but as I said, it doesn't happen every time. It might be that specificity of my code causes that GC sometimes kicks in at a specific moment (?). I think I'm safe to assume that it is not my mistake because keeping a handle to PromiseChangeFuncNative should be done by PromiseChangeFuncWrapper class after I provide PromiseChangeFunc delegate. What I understand should happen here is PersistUntilCalled() should be called somewhere but it is not. I'm attaching the code that I'm basing on (from their github). I haven't modified OnNegotiationNeeded and OnOfferCreated methods at all, other parts are only slightly modified to get data from custom appsrc but I am unable to provide the exact code.
-- 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/gstreamer-sharp/issues/9.