Changeset 140 for branches


Ignore:
Timestamp:
Dec 30, 2023, 2:20:44 PM (20 months ago)
Author:
erdmann
Message:

partly revert the changes for "fix a trap that reports on my system in CWMMCls.LOG as "Trap occured in createBMPObjectProc, file c/c_image/cwimage.c, around line 245."" Otherwise, lighttable folders containing images will flicker. I assume that the memory freeing fix in SVN rev 139 fixed the real problem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/v2.9_Lars/classes/c/c_image/cwimage.c

    r139 r140  
    151151          case ACKEY_CREATE_SMALLBITMAP:
    152152            {
     153              BOOL bLoaded=FALSE;
    153154              HBITMAP hbm;
    154155              PCREATEBMPINFO pCreateBMP=PVOIDFROMMP(mp1);
     
    199200
    200201                  /* Check if in the meantime the bitmap was created */
    201                   if(!_hBitmapSmall && _hBitmap) {
     202                  if(!_hBitmapSmall) {
    202203                    /*
    203204                       FIXME:
     
    206207
    207208                       Use a private work alike for wpQueryBitmapHandle instead???
    208                     */
    209 
     209                       
     210                       Check if bitmap data already loaded. Keep the info so we don't discard the bitmap later on. Another
     211                       function may have requested the bitmap before. During wpQueryBitmapHandle() a normal size bitmap
     212                       is always created. We don't want to have memory wasted by the big one so it's discarded afterwards.
     213                       Not perfect, but works at the moment. Will be revamped later with automatic bitmap deletion. */
     214                    if(_hBitmap)
     215                      bLoaded=TRUE;
     216                   
    210217                    if(_wpQueryBitmapHandle(pCreateBMP->wpObject,
    211218                                            &hbm,
     
    218225                      _hBitmapSmall=hbm;
    219226                      _ulSizeSmallBitmap=pCreateBMP->ulHeight;
     227                      if(!bLoaded) {
    220228                      /* Discard the large bitmap now, we don't need it any more as we have
    221229                         the small one. */
    222230                      GpiDeleteBitmap(_hBitmap);
    223231                      _hBitmap=NULLHANDLE;
     232                      }
    224233                    }/* _wpQueryBitmapHandle() */
    225234                  }
     
    230239                }/* for */
    231240              }/* Try */
    232               CATCH(BITMAP_OBJECT)
    233                 {
     241              CATCH(BITMAP_OBJECT) {
    234242                  SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d.\n",
    235243                                    __FUNCTION__, __FILE__, __LINE__);
    236                 } END_CATCH;
    237                 _wpUnlockObject(pCreateBMP->wpObject);
    238                 //        WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION));
    239                 //   _wp_FreeMem(wpObject, (PBYTE)pCreateBMP);
    240                 free((PBYTE)pCreateBMP);
    241 
    242                 return (MRESULT) FALSE;
     244              } END_CATCH;
     245              _wpUnlockObject(pCreateBMP->wpObject);
     246              //        WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION));
     247              //   _wp_FreeMem(wpObject, (PBYTE)pCreateBMP);
     248              free((PBYTE)pCreateBMP);
     249
     250              return (MRESULT) FALSE;
    243251            }/* case ACKEY_CREATE_SMALLBITMAP */
    244252          case ACKEY_QUERY_BITMAPINFO:
Note: See TracChangeset for help on using the changeset viewer.