Bernhard Übelacker : user32: Don' t hide the window in SetParent when window and parent are equal.

Alexandre Julliard julliard at winehq.org
Fri Feb 5 08:42:32 CST 2010


Module: wine
Branch: master
Commit: 8d127f3a813700ba7086133fa9ec7cede812f97c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8d127f3a813700ba7086133fa9ec7cede812f97c

Author: Bernhard Übelacker <bernhardu at vr-web.de>
Date:   Tue Feb  2 14:16:02 2010 +0100

user32: Don't hide the window in SetParent when window and parent are equal.

---

 dlls/user32/tests/win.c |    6 ++++++
 dlls/user32/win.c       |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 615cb2a..d524bcc 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -445,6 +445,12 @@ static void test_parent_owner(void)
     ret = SetParent( test, child );
     ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop );
     check_parents( test, child, child, 0, 0, hwndMain, test );
+
+    ShowWindow( test, SW_SHOW );
+    ret = SetParent( test, test );
+    ok( ret == NULL, "SetParent return value %p expected %p\n", ret, NULL );
+    ok( GetWindowLongA( test, GWL_STYLE ) & WS_VISIBLE, "window is not visible after SetParent\n" );
+    check_parents( test, child, child, 0, 0, hwndMain, test );
     DestroyWindow( test );
 
     /* owned popup */
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 9a19b2a..adf74d0 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2701,6 +2701,12 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
     if (!(full_handle = WIN_IsCurrentThread( hwnd )))
         return (HWND)SendMessageW( hwnd, WM_WINE_SETPARENT, (WPARAM)parent, 0 );
 
+    if (full_handle == parent)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return 0;
+    }
+
     /* Windows hides the window first, then shows it again
      * including the WM_SHOWWINDOW messages and all */
     was_visible = ShowWindow( hwnd, SW_HIDE );




More information about the wine-cvs mailing list