mirror of
https://github.com/reactos/reactos.git
synced 2024-10-23 14:36:11 +00:00
minor fix to SetParent()
svn path=/trunk/; revision=8427
This commit is contained in:
parent
8219d9801e
commit
b48c6953d0
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: window.c,v 1.196 2004/02/27 01:05:45 weiden Exp $
|
/* $Id: window.c,v 1.197 2004/02/27 22:21:32 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -872,7 +872,10 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
|
||||||
HWND hWnd, hWndNewParent, hWndOldParent;
|
HWND hWnd, hWndNewParent, hWndOldParent;
|
||||||
BOOL WasVisible;
|
BOOL WasVisible;
|
||||||
BOOL MenuChanged;
|
BOOL MenuChanged;
|
||||||
|
|
||||||
|
ASSERT(Wnd);
|
||||||
|
ASSERT(WndNewParent);
|
||||||
|
|
||||||
hWnd = Wnd->Self;
|
hWnd = Wnd->Self;
|
||||||
hWndNewParent = WndNewParent->Self;
|
hWndNewParent = WndNewParent->Self;
|
||||||
|
|
||||||
|
@ -908,8 +911,6 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WndOldParent)
|
|
||||||
IntReleaseWindowObject(WndOldParent);
|
|
||||||
/*
|
/*
|
||||||
* SetParent additionally needs to make hwnd the topmost window
|
* SetParent additionally needs to make hwnd the topmost window
|
||||||
* in the x-order and send the expected WM_WINDOWPOSCHANGING and
|
* in the x-order and send the expected WM_WINDOWPOSCHANGING and
|
||||||
|
@ -927,7 +928,19 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
|
||||||
* Validate that the old parent still exist, since it migth have been
|
* Validate that the old parent still exist, since it migth have been
|
||||||
* destroyed during the last callbacks to user-mode
|
* destroyed during the last callbacks to user-mode
|
||||||
*/
|
*/
|
||||||
return !IntIsWindow(hWndOldParent) ? NULL : WndOldParent;
|
if(WndOldParent)
|
||||||
|
{
|
||||||
|
if(!IntIsWindow(WndOldParent->Self))
|
||||||
|
{
|
||||||
|
IntReleaseWindowObject(WndOldParent);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* don't dereference the window object here, it must be done by the caller
|
||||||
|
of IntSetParent() */
|
||||||
|
return WndOldParent;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
|
@ -2311,6 +2324,7 @@ NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
|
||||||
|
|
||||||
if (!(Wnd = IntGetWindowObject(hWndChild)))
|
if (!(Wnd = IntGetWindowObject(hWndChild)))
|
||||||
{
|
{
|
||||||
|
IntReleaseWindowObject(WndParent);
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2320,6 +2334,7 @@ NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
|
||||||
if (WndOldParent)
|
if (WndOldParent)
|
||||||
{
|
{
|
||||||
hWndOldParent = WndOldParent->Self;
|
hWndOldParent = WndOldParent->Self;
|
||||||
|
IntReleaseWindowObject(WndOldParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntReleaseWindowObject(Wnd);
|
IntReleaseWindowObject(Wnd);
|
||||||
|
|
Loading…
Reference in a new issue