Browse Source

Dispose window framebuffers.

pull/4254/head
Dariusz Komosinski 6 years ago
parent
commit
1d94f80f7f
  1. 10
      src/Shared/PlatformSupport/StandardRuntimePlatform.cs
  2. 8
      src/Windows/Avalonia.Win32/FramebufferManager.cs
  3. 2
      src/Windows/Avalonia.Win32/WindowImpl.cs

10
src/Shared/PlatformSupport/StandardRuntimePlatform.cs

@ -86,11 +86,15 @@ namespace Avalonia.Shared.PlatformSupport
#if DEBUG
if (Thread.CurrentThread.ManagedThreadId == GCThread?.ManagedThreadId)
{
lock(_lock)
lock (_lock)
{
if (!IsDisposed)
{
Console.Error.WriteLine("Native blob disposal from finalizer thread\nBacktrace: "
+ Environment.StackTrace
+ "\n\nBlob created by " + _backtrace);
+ Environment.StackTrace
+ "\n\nBlob created by " + _backtrace);
}
}
}
#endif
DoDispose();

8
src/Windows/Avalonia.Win32/FramebufferManager.cs

@ -5,7 +5,7 @@ using Avalonia.Win32.Interop;
namespace Avalonia.Win32
{
class FramebufferManager : IFramebufferPlatformSurface
class FramebufferManager : IFramebufferPlatformSurface, IDisposable
{
private readonly IntPtr _hwnd;
private WindowFramebuffer _fb;
@ -31,5 +31,11 @@ namespace Avalonia.Win32
return _fb;
}
public void Dispose()
{
_fb?.Deallocate();
_fb = null;
}
}
}

2
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -389,6 +389,8 @@ namespace Avalonia.Win32
UnregisterClass(_className, GetModuleHandle(null));
_className = null;
}
_framebuffer.Dispose();
}
public void Invalidate(Rect rect)

Loading…
Cancel
Save