verjoz
asked on
How can I access a Timage form a Tread safely?
I have encountered a problem using VCL and Threads. I know Syncronize is must be used to access the components on the form (like SpinEdit etc) but how can I access an Image safely from a thread?
(i have "Invalid pointer" errors randomly and this makes me feel the Image access can be the problem. )
Thank you
(i have "Invalid pointer" errors randomly and this makes me feel the Image access can be the problem. )
Thank you
ASKER
Thank you for your response. I have to draw a picture coming from a USB camera to the Timage. So the steps:
- I get a buffer of the actual camera picture in (RGB format) in the thread
- I update it to the image1.picture.bitmap using the scanline pixel by pixel in the thread
- and finially I use the Image1.Refresh to appear the actual frame in the thread
How else can I solve it? And is it thread safe?
- I get a buffer of the actual camera picture in (RGB format) in the thread
- I update it to the image1.picture.bitmap using the scanline pixel by pixel in the thread
- and finially I use the Image1.Refresh to appear the actual frame in the thread
How else can I solve it? And is it thread safe?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One other thing to be careful of is the fact that some on screen controls use their own thread. Trying to update such a control from within a synchronized call from another thread can cause problems. Normally in this situation I make it easy on myself and use a simpler control.
If you need more help it would help to know more about what you are trying to accomplish.