Last Comment Bug 314138 - gtkmozembed fails to init with xulrunner
: gtkmozembed fails to init with xulrunner
Status: RESOLVED FIXED
: fixed1.8
Product: Core Graveyard
Classification: Graveyard
Component: Embedding: GTK Widget (show other bugs)
: Trunk
: All Linux
: -- normal (vote)
: ---
Assigned To: Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
: Stuart Parmenter
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-27 21:17 PDT by Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
Modified: 2012-04-05 00:46 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
fix (981 bytes, patch)
2005-10-27 21:18 PDT, Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
benjamin: review+
mtschrep: approval1.8rc2+
Details | Diff | Review

Description Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2005-10-27 21:17:26 PDT
Some of our xulrunner builds have a problem where they fail to init XPCOM. The problem is in EmbedPrivate.cpp we pass non-null kPStaticModules to NS_InitEmbedding but kStaticModuleCount is zero. We should pass null kPStaticModules (the default) so InitXPCOM will setup the static modules that are part of libxul. Now for some reason I can't figure out, it does work in my debug xulrunner build. Here's my gdb session in a build that works:

492         rv = NS_InitEmbedding(binDir, sAppFileLocProvider, kPStaticModules, kStaticModuleCount);
(gdb) p binDir
$12 = {mRawPtr = 0x51f7a0}
(gdb) p sAppFileLocProvider
$13 = (class nsIDirectoryServiceProvider *) 0x0
(gdb) p kPStaticModules
$14 = (const nsStaticModuleInfo * const) 0x2aaaaffef300
(gdb) s
nsCOMPtr<nsILocalFile>::operator nsDerivedSafe<nsILocalFile>* (
    this=0x7fffffcf4a40) at nsCOMPtr.h:843
843               return get();
(gdb) s
nsCOMPtr<nsILocalFile>::get (this=0x7fffffcf4a40) at nsCOMPtr.h:831
831               return NS_REINTERPRET_CAST(nsDerivedSafe<T>*, mRawPtr);
(gdb) s
0x00002aaaada72515 in nsCOMPtr<nsILocalFile>::operator nsDerivedSafe<nsILocalFile>* (this=0x7fffffcf4a40) at nsCOMPtr.h:843
843               return get();
(gdb) s

Breakpoint 3, NS_InitEmbedding (mozBinDirectory=0x51f7a0,
    appFileLocProvider=0x0, aStaticComponents=0x0, aStaticComponentCount=0)
    at nsEmbedAPI.cpp:94
94          sInitCounter++;
(gdb) quit

Notice how kPStaticModules was non-zero in the caller and it magically becomes zero in the callee.

Rather than debug that demon I made up a patch to just pass nothing in here. It works. I don't know if it's safe for Firefox though --- bsmedberg?
Comment 1 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2005-10-27 21:18:49 PDT
Created attachment 201083 [details] [diff] [review]
fix

As described.
Comment 2 Benjamin Smedberg [:bsmedberg] 2005-10-28 06:05:02 PDT
Comment on attachment 201083 [details] [diff] [review]
fix

Iterations of the static-module code make the old code "correct"... good catch. I'd be interested to figure out why kPStaticModules was not null in your case...
Comment 3 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2005-10-31 17:26:24 PST
checked in on trunk.
Comment 4 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2005-10-31 17:28:01 PST
Comment on attachment 201083 [details] [diff] [review]
fix

This fix is necessary to make gtkmozembed work at all with xulrunner. It's low risk and has *zero* impact on anyone except Linux embedding.
Comment 5 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2005-11-01 14:59:59 PST
Fixed on branch. Thanks!

Note You need to log in before you can comment on or make changes to this bug.