Recent

Author Topic: Is TResourceCacheItem thread-safe?  (Read 4026 times)

Bernd

  • Newbie
  • Posts: 3
    • SoftVision Development
Is TResourceCacheItem thread-safe?
« on: March 22, 2010, 06:43:30 pm »
Hi,

I have the problem that I get exceptions in the class TResourceCacheItem at the line

  if FReferenceCount=0 then
    RaiseRefCountZero;       // <----------

in LCLResCache.pas (Method "TResourceCacheItem.DecreaseRefCount;"). The function "RaiseRefCountZero" is called (which throws the exception), because "FReferenceCount" is zero and some other routine wants to decrement the variable.

The stack trace shows that it is always called from the class "TFontHandleCache". I create images in different threads and write some text on them. The problem does not occurs in each iteration.

Do I have to block each bitmap operation (TBitmap from graphics.pp) with a critical section? Any hint is welcome.

42 - The Answer to Life, the Universe, and Everything :-)

 

TinyPortal © 2005-2018