From a800dfe52e89c191a0b95345a2863bf7485f3555 Mon Sep 17 00:00:00 2001 From: Ulrich Czekalla Date: Tue, 26 Apr 2005 08:16:17 +0000 Subject: [PATCH] SetParent should not remove menu from non-child windows. --- dlls/user/tests/win.c | 12 +++++++++++- dlls/x11drv/window.c | 5 ----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/user/tests/win.c b/dlls/user/tests/win.c index 52d85450d64..7a639a070b1 100644 --- a/dlls/user/tests/win.c +++ b/dlls/user/tests/win.c @@ -2409,8 +2409,9 @@ static void test_SetParent(void) { BOOL ret; HWND desktop = GetDesktopWindow(); + HMENU hMenu; BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0; - HWND parent, child1, child2, child3, child4; + HWND parent, child1, child2, child3, child4, sibling; parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW, 100, 100, 200, 200, 0, 0, 0, NULL); @@ -2476,10 +2477,19 @@ todo_wine { check_parents(child4, desktop, child2, child2, child2, child4, parent); } + hMenu = CreateMenu(); + sibling = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW, + 100, 100, 200, 200, 0, hMenu, 0, NULL); + assert(sibling != 0); + + ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n"); + ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n"); + ret = DestroyWindow(parent); ok( ret, "DestroyWindow() error %ld\n", GetLastError()); ok(!IsWindow(parent), "parent still exists\n"); + ok(!IsWindow(sibling), "sibling still exists\n"); ok(!IsWindow(child1), "child1 still exists\n"); ok(!IsWindow(child2), "child2 still exists\n"); ok(!IsWindow(child3), "child3 still exists\n"); diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c index 71042552d36..78bc35bb628 100644 --- a/dlls/x11drv/window.c +++ b/dlls/x11drv/window.c @@ -1134,11 +1134,6 @@ HWND X11DRV_SetParent( HWND hwnd, HWND parent ) if (parent != GetDesktopWindow()) /* a child window */ { - if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)) - { - HMENU menu = (HMENU)SetWindowLongPtrW( hwnd, GWLP_ID, 0 ); - if (menu) DestroyMenu( menu ); - } if (old_parent == GetDesktopWindow()) { /* destroy the old X windows */ -- 2.11.4.GIT