Changeset 5964 for trunk/src


Ignore:
Timestamp:
Jun 11, 2001, 4:37:46 PM (24 years ago)
Author:
sandervl
Message:

Reference count bugfixes

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r5951 r5964  
    1 /* $Id: gen_object.cpp,v 1.10 2001-06-10 12:05:38 sandervl Exp $ */
     1/* $Id: gen_object.cpp,v 1.11 2001-06-11 14:37:46 sandervl Exp $ */
    22/*
    33 * Generic Object Class for OS/2
     
    9191LONG GenericObject::addRef()
    9292{
    93 ////  dprintf(("addRef %x -> refcount %x", this, refCount));
     93  dprintf2(("addRef %x -> refcount %x", this, refCount+1));
    9494  return InterlockedIncrement(&refCount);
    9595}
     
    9999LONG GenericObject::release()
    100100{
    101 ////  dprintf(("release %x -> refcount %x", this, refCount));
     101  dprintf2(("release %x -> refcount %x", this, refCount-1));
    102102#ifdef DEBUG
    103103  if(refCount-1 < 0) {
     
    106106#endif
    107107  if(InterlockedDecrement(&refCount) == 0 && fDeletePending) {
     108      dprintf2(("marked for deletion -> delete now"));
    108109      delete this;
    109110      return 0;
  • trunk/src/user32/win32wbase.cpp

    r5951 r5964  
    1 /* $Id: win32wbase.cpp,v 1.262 2001-06-10 12:05:40 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.263 2001-06-11 14:37:46 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    203203        setParent(NULL);  //or else we'll crash in the dtor of the ChildWindow class
    204204    }
    205 
     205    else
     206    if(getParent() && getParent()->getFirstChild() == this && getNextChild() == NULL)
     207    {
     208        //if we're the last child that's being destroyed and our
     209        //parent window was also destroyed, then we
     210        if(getParent()->IsWindowDestroyed())
     211        {
     212            setParent(NULL);  //or else we'll crash in the dtor of the ChildWindow class
     213        }
     214    }
    206215    /* Decrement class window counter */
    207216    if(windowClass) {
     
    238247    }
    239248    Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();
    240     if(wndparent) {
     249    if(wndparent && !fDestroyAll) {
    241250        RELEASE_WNDOBJ(wndparent);
    242251    }
    243     if(owner) {
     252    if(owner && !fDestroyAll) {
    244253        RELEASE_WNDOBJ(owner);
    245254    }
     
    427436        else
    428437        {
    429             owner = GetWindowFromHandle(GetWindowFromHandle(cs->hwndParent)->GetTopParent());
     438            Win32BaseWindow *wndparent = GetWindowFromHandle(cs->hwndParent);
     439            if(wndparent) {
     440                 owner = GetWindowFromHandle(wndparent->GetTopParent());
     441                 RELEASE_WNDOBJ(wndparent);
     442            }
     443            else owner = NULL;       
     444
    430445            if(owner == NULL)
    431446            {
Note: See TracChangeset for help on using the changeset viewer.