OK, an update to the problem.  I've run my code with a debug build of
Mozilla 1.3.1 and got the following output:

WARNING: Trying to set p, file
c:/mozilla_debug/mozilla/modules/libpref/src/prefapi.cpp, line 1017
###!!! ASSERTION: nsWebBrowser not thread-safe: 'owningThread ==
NS_CurrentThread()', file c:/mozilla_debug/mozilla/xpcom/glue/nsDebug.cpp,
line 533
###!!! ASSERTION: nsProxyCreateInstance not thread-safe: 'owningThread ==
NS_CurrentThread()', file c:/mozilla_debug/mozilla/xpcom/glue/nsDebug.cpp,
line 533
Break: at file c:/mozilla_debug/mozilla/xpcom/glue/nsDebug.cpp, line 533
Break: at file c:/mozilla_debug/mozilla/xpcom/glue/nsDebug.cpp, line 533
###!!! ASSERTION: RgnRectMemoryAllocator not thread-safe: 'owningThread ==
NS_CurrentThread()', file c:/mozilla_debug/mozilla/xpcom/glue/nsDebug.cpp,
line 533
Break: at file c:/mozilla_debug/mozilla/xpcom/glue/nsDebug.cpp, line 533

Shortly after this happens Windows XP throws up one of those send error
report boxes.  With the release build it simple freezes my thread.

I admit I don't really understand what's going on.  The reason I was using
proxies is to avoid thread-safety problems.  Are these assertions false
positives?  Either way, does anyone have any ideas what might be causing
this?  Thanks in advance!
--
Brad Fish
[EMAIL PROTECTED]
TALL Group Programmer

"Brad Fish" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having a really strange problem and am wondering if anyone out there
> knows how to solve it.
>
> I'm embedding Mozilla in a Java program.  I'm creating a new native
thread,
> inside which I call NS_InitEmbedding, etc., and then enter a native event
> loop.  From another thread in Java, I'm calling into my native code to
> create an embedded WebBrowser instance.  In order to make sure that it
gets
> created on the main XPCOM UI thread and eliminate threading issues in
> subsequent calls, I'm using the nsIProxyObjectManager's GetProxy method to
> defer creation onto the main XPCOM thread.  Here's the code I'm using:
>
> proxy_service = do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv);
> if (NS_FAILED(proxy_service->GetProxy(NS_UI_THREAD_EVENTQ, kWebBrowserCID,
>   nsnull, NS_GET_IID(nsIWebBrowser), PROXY_SYNC | PROXY_ALWAYS,
>   (void **)&web_browser)))
>   return false;
>
> After this I use GetProxyForObject to get nsIWebNavigation, nsIBaseWindow,
> etc.
>
> Everything works 75% of the time without any problems whatsoever.
However,
> sometimes (it appears to be somewhat random), my thread will hang on the
> call to GetProxy, which never returns.  I'm not really sure what could be
> causing this to happen, and like I said, things work great most of the
time.
>
> I'm working with a release build that I made from the 1.3.1 source code.
> I'm hoping that someone might have some ideas or be able to point me in
the
> right direction, otherwise I'm going to plan on making a debug build and
see
> if I'm my code is triggering some asserts that I may be missing in the
> release build.
>
> Thanks in advance.
> --
> Brad Fish
> [EMAIL PROTECTED]
> TALL Group Programmer
>
>



Reply via email to