Skip to content

Commit ceefdb1

Browse files
committed
Stop throwing in WndProc of SubclassingWindow
1 parent 17a7a28 commit ceefdb1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Rubberduck.VBEEditor/WindowsApi/SubclassingWindow.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected SubclassingWindow(IntPtr subclassId, IntPtr hWnd)
4343
public void Dispose()
4444
{
4545
ReleaseHandle();
46-
//GC.SuppressFinalize(this);
46+
_thisHandle.Free();
4747
}
4848

4949
private void AssignHandle()
@@ -86,14 +86,13 @@ public virtual int SubClassProc(IntPtr hWnd, IntPtr msg, IntPtr wParam, IntPtr l
8686
{
8787
if (!_listening)
8888
{
89-
throw new Exception("State corrupted. Received window message while not listening.");
89+
Debug.WriteLine("State corrupted. Received window message while not listening.");
90+
return DefSubclassProc(hWnd, msg, wParam, lParam);
9091
}
9192

92-
Debug.Assert(IsWindow(_hwnd));
9393
if ((uint)msg == (uint)WM.RUBBERDUCK_SINKING || (uint)msg == (uint)WM.DESTROY)
9494
{
95-
ReleaseHandle();
96-
_thisHandle.Free();
95+
ReleaseHandle();
9796
}
9897
return DefSubclassProc(hWnd, msg, wParam, lParam);
9998
}

0 commit comments

Comments
 (0)