Index: clipboard.c =================================================================== --- win32ss/user/ntuser/clipboard.c (revision 75017) +++ win32ss/user/ntuser/clipboard.c (working copy) @@ -448,9 +448,14 @@ { /* Return next format */ pElement = IntGetFormatElement(pWinStaObj, fmt); - ++pElement; - if (pElement < &pWinStaObj->pClipBase[pWinStaObj->cNumClipFormats]) - Ret = pElement->fmt; + if (pElement != NULL) + { + ++pElement; + if (pElement < &pWinStaObj->pClipBase[pWinStaObj->cNumClipFormats]) + { + Ret = pElement->fmt; + } + } } cleanup: Index: main.c =================================================================== --- win32ss/user/ntuser/main.c (revision 75017) +++ win32ss/user/ntuser/main.c (working copy) @@ -708,6 +708,8 @@ ptiCurrent->TIF_flags |= TIF_DONTATTACHQUEUE; ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags; + UserCloseClipboard(); + /* Decrement thread count and check if its 0 */ ppiCurrent->cThreads--;