gircore/gir.core

GObject: Execute object disposal on main thread

Closed this issue · 0 comments

To fix a bug occurring in Pinta the ObjectHandle should dispose the object instance on the main thread:

public void Dispose()
{    
    var sourceFunc = new SourceFuncAsyncHandler(() =>
    {
        Internal.Object.RemoveToggleRef(_handle, _callback, IntPtr.Zero);
        return false;
    });
    MainContext.Invoke(MainContextUnownedHandle.NullHandle, sourceFunc.NativeCallback, IntPtr.Zero);
}