Changeset 9101 for trunk/src


Ignore:
Timestamp:
Aug 23, 2002, 5:06:01 PM (23 years ago)
Author:
sandervl
Message:

Ugly hack added to work around crash in PM when child window calls DestroyWindow for parent or owner in WM_DESTROY handler (solution: postpone DestroyWindow for parent/owner)

Location:
trunk/src/user32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/pmwindow.cpp

    r9008 r9101  
    1 /* $Id: pmwindow.cpp,v 1.187 2002-08-15 15:45:45 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.188 2002-08-23 15:06:00 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    10701070    }
    10711071
     1072//hack alert; PM crashes if child calls DestroyWindow for parent/owner in WM_DESTROY
     1073//            handler; must postpone it, so do it here
     1074    case WIN32APP_POSTPONEDESTROY:
     1075        OSLibWinDestroyWindow(hwnd);
     1076        break;
     1077//hack end
     1078
    10721079#ifdef DEBUG
    10731080    case WM_CLOSE:
  • trunk/src/user32/win32wbase.cpp

    r9001 r9101  
    1 /* $Id: win32wbase.cpp,v 1.335 2002-08-14 10:37:44 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.336 2002-08-23 15:06:01 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    149149  fParentChange    = FALSE;
    150150  fDestroyWindowCalled = FALSE;
     151  fChildDestructionInProgress = FALSE;
    151152  fTaskList        = FALSE;
    152153  fParentDC        = FALSE;
     
    924925
    925926    if(fDestroyWindowCalled == FALSE)
    926     {//this window was destroyed because DestroyWindow was called for it's parent
     927    {//this window was destroyed because DestroyWindow was called for its parent
    927928     //so: send a WM_PARENTNOTIFY now as that hasn't happened yet
    928929        if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY))
     
    26832684//******************************************************************************
    26842685//Also destroys all the child windows (destroy children first, parent last)
     2686//TODO: Don't rely on PM to do the right thing. Send WM_(NC)DESTROY &
     2687//      destroy children ourselves (see Wine)
    26852688//******************************************************************************
    26862689BOOL Win32BaseWindow::DestroyWindow()
     
    27602763 
    27612764    fDestroyWindowCalled = TRUE;
    2762     return OSLibWinDestroyWindow(OS2HwndFrame);
     2765
     2766//hack alert; PM crashes if child calls DestroyWindow for parent/owner in WM_DESTROY
     2767//            handler; must postpone it
     2768    if(fChildDestructionInProgress) {
     2769        dprintf(("Postponing parent destruction because of dying child"));
     2770        OSLibPostMessageDirect(OS2HwndFrame, WIN32APP_POSTPONEDESTROY, 0, 0);
     2771        return TRUE;
     2772    }
     2773
     2774    BOOL fOldChildDestructionInProgress = FALSE;
     2775    if(GetParent()) {
     2776        Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(GetParent());
     2777        if(window) {
     2778            fOldChildDestructionInProgress = window->IsChildDestructionInProgress();
     2779            window->SetChildDestructionInProgress(TRUE);
     2780            RELEASE_WNDOBJ(window);
     2781        }
     2782    }
     2783//hack end
     2784
     2785    BOOL ret = OSLibWinDestroyWindow(OS2HwndFrame);
     2786
     2787//hack alert; PM crashes if child calls DestroyWindow for parent/owner in WM_DESTROY
     2788//            handler; must postpone it
     2789    if(GetParent()) {
     2790        Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(GetParent());
     2791        if(window) {
     2792            window->SetChildDestructionInProgress(fOldChildDestructionInProgress);
     2793            RELEASE_WNDOBJ(window);
     2794        }
     2795    }
     2796//hack end
     2797    return ret;
    27632798}
    27642799//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r8553 r9101  
    1 /* $Id: win32wbase.h,v 1.143 2002-06-02 19:34:36 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.144 2002-08-23 15:06:01 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    7373//NOTE Must be smaller than WIN32APP_POSTMSG!
    7474#define WIN32APP_SETFOCUSMSG      (WIN32APP_POSTMSG-1)
     75#define WIN32APP_POSTPONEDESTROY  (WIN32APP_POSTMSG-2)
    7576
    7677#define WIN32MSG_MAGICA           0x12345678
     
    284285         BOOL   IsWindowDestroyed()           { return state >= STATE_DESTROYED; };
    285286         BOOL   IsWindowIconic();
     287
     288//hack alert (see DestroyWindow)
     289         BOOL   IsChildDestructionInProgress() { return fChildDestructionInProgress; };
     290         void   SetChildDestructionInProgress(BOOL fDestuctionInProgress)
     291         {
     292             fChildDestructionInProgress = fDestuctionInProgress;
     293         };
     294//hack end
     295
    286296         //Window procedure type
    287297         BOOL   IsWindowUnicode();
     
    415425                 fParentChange:1,
    416426                 fDestroyWindowCalled:1, //DestroyWindow was called for this window
     427                 fChildDestructionInProgress:1,
    417428                 fTaskList:1,            //should be listed in PM tasklist or not
    418429                 fXDefault:1,
Note: See TracChangeset for help on using the changeset viewer.