StatusIcon: dispose properly
Override Dispose method of Component class, so it calls the backend's Dispose method.
This commit is contained in:
Родитель
3bb3e98051
Коммит
7577226127
|
@ -62,6 +62,12 @@ namespace Xwt.Mac
|
|||
|
||||
public void EnableEvent (object eventId) { throw new NotImplementedException (); }
|
||||
public void DisableEvent (object eventId) { throw new NotImplementedException (); }
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
statusItem.Dispose ();
|
||||
statusItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.Collections.ObjectModel;
|
|||
|
||||
namespace Xwt.Backends
|
||||
{
|
||||
public interface IStatusIconBackend : IBackend
|
||||
public interface IStatusIconBackend : IBackend, IDisposable
|
||||
{
|
||||
void SetMenu (object menuBackend);
|
||||
|
||||
|
|
|
@ -54,6 +54,16 @@ namespace Xwt
|
|||
IStatusIconBackend Backend {
|
||||
get { return (IStatusIconBackend) BackendHost.Backend; }
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
base.Dispose (disposing);
|
||||
|
||||
// Don't dispose the backend if this object is being finalized
|
||||
// The backend has to handle the finalizing on its own
|
||||
if (disposing && BackendHost.BackendCreated)
|
||||
Backend.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче