[Lazarus] OSX: Handles and WindowRefs
Duncan Parsons
lazarus at dsparsons.co.uk
Sun Jan 11 02:59:38 CET 2009
Hi,
I have declared a couple of procedures with the message attribute in a
form class, descended from TForm, like so:
procedure Log_message(var msg: UserMsg); Message LM_USER;
procedure Thread_complete(var msg: UserMsg); Message LM_USER+1;
The structure UserMsg has a Cardinal in the first position to hold the
message id. This is always set correctly to one of the two values based
on LM_USER, as above.
The background thread's class, descended from TThread, contains a
pointer to the form that invoked the thread in a field named
Parent_form.
When the background thread comes to post a message to the parent form,
it uses the Dispatch() method of TObject, inherited through TForm to the
form's class. However, the call never returns and the application hangs.
I have also tried the DeliverMessage() function, but the results are
identical.
This looks rather like some sort of deadlock on something like a mutex
semaphore -- but that's just a guess. Is there some "knack" to calling
Dispatch() that avoids this problem?
--
Regards,
Dave [RLU #314465]
======================================================================
dwnoon at ntlworld.com (David W Noon)
======================================================================
More information about the Lazarus
mailing list