Changeset 4857 for trunk/src


Ignore:
Timestamp:
Dec 30, 2000, 2:28:32 PM (25 years ago)
Author:
sandervl
Message:

DeleteObject fix: check for system brushes & pens and don't delete those objects

File:
1 edited

Legend:

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

    r4769 r4857  
    1 /* $Id: objhandle.cpp,v 1.9 2000-12-09 15:00:35 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.10 2000-12-30 13:28:32 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    297297}
    298298//******************************************************************************
     299//TODO: System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
    299300//******************************************************************************
    300301BOOL WIN32API DeleteObject(HANDLE hObj)
    301302{
     303 DWORD type;
     304
    302305    dprintf(("GDI32: DeleteObject %x", hObj));
     306
     307    //System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
     308    type = GetObjectType(hObj);
     309    if(type == OBJ_PEN && IsSystemPen(hObj)) {
     310        SetLastError(ERROR_SUCCESS);
     311        return TRUE;
     312    }
     313    if(type == OBJ_BRUSH && IsSystemBrush(hObj)) {
     314        SetLastError(ERROR_SUCCESS);
     315        return TRUE;
     316    }
     317
    303318    if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
    304319        OSLibDeleteRegion(ObjGetHandleData(hObj, GDIOBJ_REGION));
    305320        ObjFreeHandle(hObj);
    306321        SetLastError(ERROR_SUCCESS);
    307         return OBJ_REGION;
     322        return TRUE;
    308323    }
    309324    DIBSection::deleteSection((DWORD)hObj);
Note: See TracChangeset for help on using the changeset viewer.