https://git.reactos.org/?p=reactos.git;a=commitdiff;h=38560761cef087cfd68af…
commit 38560761cef087cfd68af94f1e938f04a938dddf
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Sun Jul 2 13:19:06 2023 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Jul 2 13:19:06 2023 +0200
[WIN32K:NTUSER] Add ASSERT() on "linking window to itself" (#4749)
Addendum to ee0511b (0.4.10-dev-323).
CORE-18132
---
win32ss/user/ntuser/window.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index b4ab2d6e69f..e587c73a58d 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -943,7 +943,8 @@ IntLinkWindow(
{
if (Wnd == WndInsertAfter)
{
- ERR("IntLinkWindow -- Trying to link window 0x%p to itself!!\n", Wnd);
+ ERR("Trying to link window 0x%p to itself\n", Wnd);
+ ASSERT(WndInsertAfter != Wnd);
return;
}
@@ -1046,8 +1047,15 @@ VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
}
if (Wnd == WndInsertAfter)
- ERR("IntLinkHwnd -- Trying to link window 0x%p to itself!!\n",
Wnd);
- IntLinkWindow(Wnd, WndInsertAfter);
+ {
+ ERR("Trying to link window 0x%p to itself\n", Wnd);
+ ASSERT(WndInsertAfter != Wnd);
+ // FIXME: IntUnlinkWindow(Wnd) was already called. Continuing as is seems
wrong!
+ }
+ else
+ {
+ IntLinkWindow(Wnd, WndInsertAfter);
+ }
/* Fix the WS_EX_TOPMOST flag */
if (!(WndInsertAfter->ExStyle & WS_EX_TOPMOST))