- Previously, Window.ViewAdded event was blocked by memory leak
- This is enabled again by the request from Appium
- This change has beend checked locally and there was no memory leak (normal)
PositionUsesPivotPoint = false;
}
- //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
- //_onWindowSendEventCallback = SendViewAddedEventToWindow;
- //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
+ onWindowSendEventCallback = SendViewAddedEventToWindow;
+ this.OnWindowSignal().Connect(onWindowSendEventCallback);
if (!shown)
{
private ResourcesLoadedCallbackType ResourcesLoadedCallback;
private EventHandler<BackgroundResourceLoadedEventArgs> backgroundResourceLoadedEventHandler;
private _backgroundResourceLoadedCallbackType backgroundResourceLoadedCallback;
-
+ private OnWindowEventCallbackType onWindowSendEventCallback;
private void SendViewAddedEventToWindow(IntPtr data)
{
// Unused parameter
backgroundResourceLoadedCallback = null;
}
+ if (onWindowSendEventCallback != null)
+ {
+ ViewSignal signal = this.OnWindowSignal();
+ signal?.Disconnect(onWindowSendEventCallback);
+ signal?.Dispose();
+ onWindowSendEventCallback = null;
+ }
+
// BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
// Restore current CPtr.
SwigCPtr = currentCPtr;