The following sample code asserts in NS_TermEmbedding when built with
release options. It seems to work fine when built with debug options. I'm
using
Mozilla 1.3.1 on Windows. (We picked 1.3.1 in order to run cross-platform
on older macs.)
ASSERTION: Component Manager being held past XPCOM shutdown.: 'cnt == 0',
file c:/Mozilla131/Mozilla/xpcom/build/nsXPComInit.cpp, line 769
Because the sample code below is nearly trivial I would assume this is a
Mozilla bug, but interestingly a release build of the MFCEmbed sample
application that comes with Mozilla 1.3.1 does *not* assert on exit.
If it's a Mozilla bug, does anyone know the fix (or a workaround)? If it's
not a Mozilla bug, what step have I missed? Also, why does the problem
appear only in release builds?
Brian
------------------------------------------------------------------------
//
// This code asserts when I build and run a release version.
// It appears to run fine when built with debugging options.
//
#include <nsEmbedAPI.h>
#include <nsDependentString.h>
#include <winEmbedFileLocProvider.h> // straight from MFCEmbed
int main(int argc, char* argv[])
{
nsresult rv;
char curDir[_MAX_PATH+1];
nsCOMPtr<nsILocalFile> mreAppDir;
::GetCurrentDirectory(_MAX_PATH, curDir);
rv = NS_NewNativeLocalFile(nsDependentCString(curDir), true,
getter_AddRefs(mreAppDir));
if (NS_FAILED(rv)) return -1;
winEmbedFileLocProvider *provider = new
winEmbedFileLocProvider("TestTaker");
if (!provider) return -1;
rv = NS_InitEmbedding(mreAppDir, provider);
if (NS_FAILED(rv)) return -1;
rv = NS_TermEmbedding(); // Asserts in here
return NS_FAILED(rv) ? -1 : 0;
}
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding