From ec8f15ffaf21200d3f9cd13964ab6c73f9f66227 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Tue, 9 Mar 1999 22:52:24 +0000 Subject: [PATCH] Fixed editor registration and startup problems --- editor/base/nsEditor.cpp | 13 +++++++------ editor/libeditor/base/nsEditor.cpp | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index e5b0ce4e030..0e2ec331a06 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -133,7 +133,7 @@ PRMonitor *getEditorMonitor() //if more than one person asks for the monitor at nsIComponentManager* gCompMgr = NULL; /* -we must be good providers of factories ect. this is where to put ALL editor exports +we must be good providers of factories etc. this is where to put ALL editor exports */ //BEGIN EXPORTS extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServMgr, @@ -148,7 +148,12 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServMgr, *aFactory = nsnull; - nsresult rv = aServMgr->QueryInterface(nsIComponentManager::GetIID(), (void**)&gCompMgr); + nsresult rv; + nsCOMPtr servMgr(do_QueryInterface(aServMgr, &rv)); + if (NS_FAILED(rv)) return rv; + + rv = servMgr->GetService(kComponentManagerCID, nsIComponentManager::GetIID(), + (nsISupports**)&gCompMgr); if (NS_FAILED(rv)) return rv; if (aClass.Equals(kEditorCID)) { @@ -352,10 +357,6 @@ nsEditor::EnableUndo(PRBool aEnable) nsITransactionManager *txnMgr = 0; nsresult result=NS_OK; -/** -- temp code until the txn mgr auto-registers -- **/ - gCompMgr->RegisterComponent(kCTransactionManagerFactoryCID, NULL, NULL, - TRANSACTION_MANAGER_DLL, PR_FALSE, PR_FALSE); -/** -- end temp code -- **/ if (PR_TRUE==aEnable) { if (!mTxnMgr) diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index e5b0ce4e030..0e2ec331a06 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -133,7 +133,7 @@ PRMonitor *getEditorMonitor() //if more than one person asks for the monitor at nsIComponentManager* gCompMgr = NULL; /* -we must be good providers of factories ect. this is where to put ALL editor exports +we must be good providers of factories etc. this is where to put ALL editor exports */ //BEGIN EXPORTS extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServMgr, @@ -148,7 +148,12 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServMgr, *aFactory = nsnull; - nsresult rv = aServMgr->QueryInterface(nsIComponentManager::GetIID(), (void**)&gCompMgr); + nsresult rv; + nsCOMPtr servMgr(do_QueryInterface(aServMgr, &rv)); + if (NS_FAILED(rv)) return rv; + + rv = servMgr->GetService(kComponentManagerCID, nsIComponentManager::GetIID(), + (nsISupports**)&gCompMgr); if (NS_FAILED(rv)) return rv; if (aClass.Equals(kEditorCID)) { @@ -352,10 +357,6 @@ nsEditor::EnableUndo(PRBool aEnable) nsITransactionManager *txnMgr = 0; nsresult result=NS_OK; -/** -- temp code until the txn mgr auto-registers -- **/ - gCompMgr->RegisterComponent(kCTransactionManagerFactoryCID, NULL, NULL, - TRANSACTION_MANAGER_DLL, PR_FALSE, PR_FALSE); -/** -- end temp code -- **/ if (PR_TRUE==aEnable) { if (!mTxnMgr)