Viewer.exe asserts

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Viewer.exe asserts

StuartX
Hi Chaps,

I'm trying to run viewer.exe and keep on getting the follwoing asserts:

D:\dump2\mozilla\obj-i686-pc-cygwin\dist\bin>viewer
Type Manifest File:
D:\dump2\mozilla\obj-i686-pc-cygwin\dist\bin\components\xpti.dat
###!!! ASSERTION: Setting main thread twice?: 'Error', file
d:/dump2/mozilla/xpcom/threads/nsThread.cpp, line 441
###!!! ASSERTION: No nsIComponentRegistrar from get service. see dougt:
'registrar', file
d:/dump2/mozilla/webshell/tests/viewer/nsViewerApp.cpp, line
 217
###!!! ASSERTION: You can't dereference a NULL nsCOMPtr with
operator->().: 'mRawPtr != 0', file
../../../dist/include/xpcom\nsCOMPtr.h, line 849
nsStringStats
 => mAllocCount:            223
 => mReallocCount:            0
 => mFreeCount:             212  --  LEAKED 11 !!!
 => mShareCount:            575
 => mAdoptCount:            141
 => mAdoptFreeCount:        141

Any ideas?

Build is for 1.5rc2, Win32 using VC++ 6.0

TIA,

Stuart

_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Viewer.exe asserts

StuartX
Ok, seems the XPCOM initialization method NS_InitXPCOM2/NS_InitXPCOM3
get's called twice when starting up. I've changed the code in the
viewer project to only get called once.

Change made to nsViewerApp.cpp:

nsresult
nsViewerApp::SetupRegistry()
{
  nsresult rv;

  nsCOMPtr<nsIServiceManager> servManager;

  rv = NS_GetServiceManager(getter_AddRefs(servManager));
  //rv = NS_InitXPCOM3(getter_AddRefs(servManager), nsnull, nsnull,
  //                   kPStaticModules, kStaticModuleCount);

  nsCOMPtr<nsIComponentRegistrar> registrar =
do_QueryInterface(servManager);
  NS_ASSERTION(registrar, "No nsIComponentRegistrar from get service.
see dougt");
  rv = registrar->AutoRegister(nsnull);

  // Register our browser window factory
  nsIFactory* bwf;
  NS_NewXPBaseWindowFactory(&bwf);
  registrar->RegisterFactory(kXPBaseWindowCID, 0, 0, bwf);
  NS_RELEASE(bwf);

  // register the cookie manager
  nsCOMPtr<nsICookieService> cookieService =
           do_GetService(kCookieServiceCID, &rv);
  if (NS_FAILED(rv) || (nsnull == cookieService)) {
#ifdef DEBUG
    printf("Unable to instantiate Cookie Manager\n");
#endif
  }

  return NS_OK;
}

Now I just have to figure out how to submit a defect change request...

Anywho, thanks for reading, hope this helps somebody else.

Stuart

_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Viewer.exe asserts

fantasai
StuartX wrote:

> Ok, seems the XPCOM initialization method NS_InitXPCOM2/NS_InitXPCOM3
> get's called twice when starting up. I've changed the code in the
> viewer project to only get called once.
>
> Change made to nsViewerApp.cpp:
>
> nsresult
> nsViewerApp::SetupRegistry()
> {
>   nsresult rv;
>
>   nsCOMPtr<nsIServiceManager> servManager;
>
>   rv = NS_GetServiceManager(getter_AddRefs(servManager));
>   //rv = NS_InitXPCOM3(getter_AddRefs(servManager), nsnull, nsnull,
>   //                   kPStaticModules, kStaticModuleCount);
>
>   nsCOMPtr<nsIComponentRegistrar> registrar =
> do_QueryInterface(servManager);
>   NS_ASSERTION(registrar, "No nsIComponentRegistrar from get service.
> see dougt");
>   rv = registrar->AutoRegister(nsnull);
>
>   // Register our browser window factory
>   nsIFactory* bwf;
>   NS_NewXPBaseWindowFactory(&bwf);
>   registrar->RegisterFactory(kXPBaseWindowCID, 0, 0, bwf);
>   NS_RELEASE(bwf);
>
>   // register the cookie manager
>   nsCOMPtr<nsICookieService> cookieService =
>            do_GetService(kCookieServiceCID, &rv);
>   if (NS_FAILED(rv) || (nsnull == cookieService)) {
> #ifdef DEBUG
>     printf("Unable to instantiate Cookie Manager\n");
> #endif
>   }
>
>   return NS_OK;
> }
>
> Now I just have to figure out how to submit a defect change request...

http://bugzilla.mozilla.org ?

~fantasai
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Viewer.exe asserts

Justin Wood (Callek)
In reply to this post by StuartX
StuartX wrote:
>   // register the cookie manager
>   nsCOMPtr<nsICookieService> cookieService =
>            do_GetService(kCookieServiceCID, &rv);
>   if (NS_FAILED(rv) || (nsnull == cookieService)) {
> #ifdef DEBUG
>     printf("Unable to instantiate Cookie Manager\n");
> #endif
>   }

Just as a casual observer, perhaps setting the #ifdef outside that block
would be useful if the ONLY action of the block is a debug printf ;-)

That would save some cycles on checking those conditions. Also as a
personal nit, which do you expect the MOST, a NS_FAILED or a nsnull ==
put the most expected first.

~Justin Wood (Callek)

[Of course I am unsure if this is mozilla.org incorporated code, or
third-party, but either way it will be helpful to do it ;-).]
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Viewer.exe asserts

Boris Zbarsky
Justin Wood (Callek) wrote:
>>   if (NS_FAILED(rv) || (nsnull == cookieService)) {
>> #ifdef DEBUG
>>     printf("Unable to instantiate Cookie Manager\n");
>> #endif
>>   }
...
> That would save some cycles on checking those conditions.

I would expect that any modern compiler will optimize away any if block with an
empty body if the condition has no side-effects.  Like the one here.

Please test and let me know whether I'm right, though.  ;)

-Boris
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Viewer.exe asserts

Justin Wood (Callek)
Boris Zbarsky wrote:

> Justin Wood (Callek) wrote:
>>>   if (NS_FAILED(rv) || (nsnull == cookieService)) {
>>> #ifdef DEBUG
>>>     printf("Unable to instantiate Cookie Manager\n");
>>> #endif
>>>   }
> ...
>> That would save some cycles on checking those conditions.
>
> I would expect that any modern compiler will optimize away any if block
> with an empty body if the condition has no side-effects.  Like the one
> here.
>
> Please test and let me know whether I'm right, though.  ;)
>

I would assume the same, (of course I am not about to check ;-) )
Though, I personally hate to leave those types of things to chance.

~Justin Wood (Callek)
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout