Thanks for the reply Brian,

The place where the the code gets called is actually an event handler of the
TIdTCPServer component. The methods used in the TCPServer's Execute event do
not belong to the TIdPeerThread that is passed into the event handler so I
can't call them using Synchonize.
I don't think uninitialisation is the problem, since it is a component that
is created with the form, and the code executes correctly when it is not
being called in the event handler.

Perhaps I should clarify. The thread comes from the TCPServer, it is for a
connection from outside. The COM object is completely unrelated to the TCP
server, but it does use sockets to connect to another server. I wonder if
the blocking model of the Indy components is causing problems for the COM
object?

Phil.
----- Original Message -----
From: "Brian Wrigley" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Tuesday, October 22, 2002 7:13 PM
Subject: Re: [DUG]: COM Object error


> You may need to initialise COM in the thread, i.e. by calling
OleInitialize
> (and OleUninitialize afterwards).
> The other thing that comes to mind is that the mechanism of invoking and
> passing parameters to the COM object may not be thread-safe. Have you
tried
> using Synchronize to call it?
>
> ----- Original Message -----
> From: "Phil Middlemiss" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 22, 2002 5:00 PM
> Subject: [DUG]: COM Object error
>
>
> > I have an app that uses the Indy components to act as a TCP server. When
> it
> > get's a connection and receives the required data, the application uses
a
> > third party COM object to communicate the data to second server running
on
> a
> > remote location.
> >
> > If I run a test routine and just send some dummy data to the second
server
> > then everything is fine. If I try exactly the same test code but this
time
> > call it when I have received some data from a connection to my TCP
server,
> > then I get an access violation from 'MSVBVM60.DLL' (the COM object was
> > written in VB).
> >
> > I'm guessing its a threading issue since the TCP server is hanging on to
a
> > TIDPeerThread from it's Execute event. I've tried placing
> > EnterCriticalSection etc around the code but it makes no difference.
> >
> > Does anyone have any ideas?
> >
> > Regards,
> > Phil.
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to