Hi all I hav created a toolbar extension in firefox. Registration and other activities r workin fine but when iam closin firefox iam gettin an error sayin
"FIREFOX causes an invalid page fault in kernel32.dll" Actually iam invokin other dll in xpcom dll usind smart pointers my code is #import "sample.dll" no_namespace _COM_SMARTPTR_TYPEDEF(Isample, __uuidof(Isample)); IsamplePtr sample1(__uuidof(sample)); MyComponent::MyComponent() { } MyComponent::~MyComponent() { } NS_IMETHODIMP MyComponent:: Xpcomfunc(void) { sample1->Mauritius(); //function in sample.dll return NS_OK; } NS_IMETHODIMP MyComponent::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) { nsresult rv; nsCOMPtr<nsIComponentManager> aCompMgr; rv = NS_GetComponentManager(getter_AddRefs(aCompMgr)); if (!aCompMgr) return NS_ERROR_UNEXPECTED; return NS_OK; } static NS_METHOD MyComponentRegistration(nsIComponentManager *aCompMgr,nsIFile *aPath,const char *registryLocation,const char *componentType,const nsModuleComponentInfo *info) { MessageBox(NULL,"Registration","Title",NULL); nsresult rv; nsCOMPtr<nsIServiceManager> servman; //nsCOMPtr<nsIServiceManager> // rv = XPCOMGlueStartup(nsnull); // rv = NS_InitXPCOM2(nsnull, nsnull, nsnull); rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull); nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); nsCOMPtr<nsIComponentManager> manager = do_QueryInterface(registrar); servman = do_QueryInterface((nsISupports*)aCompMgr, &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsICategoryManager> catman; servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID,NS_GET_IID(nsICategoryManager),getter_AddRefs(catman)); if (NS_FAILED(rv)) return rv; char* previous = nsnull; rv = catman->AddCategoryEntry("xpcom-startup",MY_COMPONENT_CLASSNAME,MY_COMPONENT_CONTRACTID,PR_TRUE,PR_TRUE,&previous); if (previous) nsMemory::Free(previous); return rv; } static NS_METHOD MyComponentUnregistration(nsIComponentManager *aCompMgr,nsIFile *aPath,const char *registryLocation,const nsModuleComponentInfo *info) { MessageBox(NULL,"UnRegistration","Title",NULL); nsresult rv; nsCOMPtr<nsIServiceManager> servman = do_QueryInterface((nsISupports*)aCompMgr, &rv); if (NS_FAILED(rv))return rv; nsCOMPtr<nsICategoryManager> catman; servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID,NS_GET_IID(nsICategoryManager),getter_AddRefs(catman)); if (NS_FAILED(rv))return rv; rv = catman->DeleteCategoryEntry("xpcom-startup",MY_COMPONENT_CLASSNAME,PR_TRUE); NS_ShutdownXPCOM(nsnull ); // XPCOMGlueShutdown(); return rv; } NS_IMPL_ISUPPORTS1(MyComponent, IMyComponent); NS_GENERIC_FACTORY_CONSTRUCTOR(MyComponent) static nsModuleComponentInfo components[] = { { MY_COMPONENT_CLASSNAME, MY_COMPONENT_CID, MY_COMPONENT_CONTRACTID, MyComponentConstructor, MyComponentRegistration, MyComponentUnregistration, } }; NS_IMPL_NSGETMODULE(MyComponentModule, components) And i hav a doubt whether i hav to Release sample1 ptr . Can anyone figure it out wats d problem? _______________________________________________ Mozilla-xpcom mailing list Mozilla-xpcom@mozilla.org http://mail.mozilla.org/listinfo/mozilla-xpcom