Fixed to not pre-create the factory

This commit is contained in:
kipp@netscape.com
1999-09-28 20:54:26 +00:00
parent f160755b92
commit a6ef7e9040

View File

@@ -99,11 +99,6 @@ nsSampleModule::Initialize()
return NS_OK;
}
mInitialized = PR_TRUE;
// Create and stash the factory object for creating new instances
// of Sample
nsresult rv;
rv = NS_NewGenericFactory(getter_AddRefs(mFactory), CreateNewSample);
return NS_OK;
}
@@ -143,6 +138,14 @@ nsSampleModule::GetClassObject(nsIComponentManager *aCompMgr,
// class type (aClass).
nsCOMPtr<nsIGenericFactory> fact;
if (aClass.Equals(kSampleCID)) {
if (!mFactory) {
// Create and save away the factory object for creating
// new instances of Sample. This way if we are called
// again for the factory, we won't need to create a new
// one.
rv = NS_NewGenericFactory(getter_AddRefs(mFactory),
CreateNewSample);
}
fact = mFactory;
}
else {