Changeset 6558 for trunk/src


Ignore:
Timestamp:
Aug 18, 2001, 5:50:32 AM (24 years ago)
Author:
phaller
Message:

Restructured DeleteObject (looking for crash in WinImage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/objhandle.cpp

    r6262 r6558  
    1 /* $Id: objhandle.cpp,v 1.16 2001-07-09 07:57:38 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.17 2001-08-18 03:50:32 phaller Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    343343BOOL WIN32API DeleteObject(HANDLE hObj)
    344344{
    345  DWORD type;
    346 
    347345    dprintf(("GDI32: DeleteObject %x", hObj));
    348346
    349347    //TODO: must use 16 bits gdi object handles
    350     if(HIWORD(hObj) == 0) {
     348    if(HIWORD(hObj) == 0)
     349    {
    351350        hObj |= GDIOBJ_PREFIX;
    352351    }
     352
    353353    //System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
    354     type = GetObjectType(hObj);
    355     if(type == OBJ_PEN && IsSystemPen(hObj)) {
    356         SetLastError(ERROR_SUCCESS);
    357         return TRUE;
    358     }
    359     if(type == OBJ_BRUSH && IsSystemBrush(hObj)) {
    360         SetLastError(ERROR_SUCCESS);
    361         return TRUE;
    362     }
    363 
    364     if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
     354    switch (GetObjectType(hObj))
     355    {
     356        case OBJ_PEN:
     357            if(IsSystemPen(hObj))
     358            {
     359                SetLastError(ERROR_SUCCESS);
     360                return TRUE;
     361            }
     362            else
     363                break;
     364
     365        case OBJ_BRUSH:
     366            if(IsSystemBrush(hObj))
     367            {
     368                SetLastError(ERROR_SUCCESS);
     369                return TRUE;
     370            }
     371            else
     372                break;
     373
     374        // add more system-type objects as required ...
     375    }
     376
     377    if(ObjGetHandleType(hObj) == GDIOBJ_REGION)
     378    {
    365379        OSLibDeleteRegion(ObjGetHandleData(hObj, GDIOBJ_REGION));
    366380        ObjFreeHandle(hObj);
     
    368382        return TRUE;
    369383    }
     384
    370385    DIBSection::deleteSection((DWORD)hObj);
    371386    return O32_DeleteObject(hObj);
Note: See TracChangeset for help on using the changeset viewer.