Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FYI: Access violation in VBScript: cannot read address 0x0000000C

6 views
Skip to first unread message

Peter van der Weerd

unread,
Jan 9, 2003, 3:58:41 PM1/9/03
to
FYI:

I recently had a problem (see subject) in a multithread app hosting a
VBScript engine. The problem occurred only on a Win2K machine, not NT4/XP.

In my case I instantiated a script engine per thread since the scriptengine
is not multi-threaded. I keep the threads in a list of threadid's. If a
script method has to be called on an unknown script I cloned the engine, and
administrated it in the threadlist. So far no problem. But now a thread
dies, and another thread is re-created and unfortuanlly it has THE SAME
threadid, so I reused the already administrated clone of the script engine.
The problem was the IDispatch interface: it uses thread-local-storage, which
is not yet initialised for the new thread, causing the access violation.

I simply fixed it by using CoGetCurrentProcess instead of GetCurrentThreadId
while administrating the threads.

Regards,
Peter

(for email: use medialab for the domain)


0 new messages