check for existence before NS_ADDREFing.

this was causing a crash in smtpTest, pop3Test and nntpTest, where we
weren't registering the EventQueue component.

also, make these destructors virtual.
This commit is contained in:
sspitzer%netscape.com 1999-05-07 00:09:46 +00:00
parent 6ffba108cb
commit b2cb4ec80d
2 changed files with 10 additions and 8 deletions

View File

@ -97,7 +97,9 @@ EventQueueStack::~EventQueueStack()
nsIEventQueue* EventQueueStack::GetEventQueue()
{
NS_ADDREF(mEventQueue);
if (mEventQueue) {
NS_ADDREF(mEventQueue);
}
return mEventQueue;
}
@ -122,7 +124,7 @@ class EventQueueEntry : public nsISupports
{
public:
EventQueueEntry();
~EventQueueEntry();
virtual ~EventQueueEntry();
// nsISupports interface...
NS_DECL_ISUPPORTS
@ -184,6 +186,7 @@ class nsEventQueueServiceImpl : public nsIEventQueueService
{
public:
nsEventQueueServiceImpl();
virtual ~nsEventQueueServiceImpl();
// nsISupports interface...
NS_DECL_ISUPPORTS
@ -201,8 +204,6 @@ public:
#ifdef XP_MAC
NS_IMETHOD ProcessEvents();
#endif // XP_MAC
protected:
~nsEventQueueServiceImpl();
private:
nsHashtable* mEventQTable;

View File

@ -97,7 +97,9 @@ EventQueueStack::~EventQueueStack()
nsIEventQueue* EventQueueStack::GetEventQueue()
{
NS_ADDREF(mEventQueue);
if (mEventQueue) {
NS_ADDREF(mEventQueue);
}
return mEventQueue;
}
@ -122,7 +124,7 @@ class EventQueueEntry : public nsISupports
{
public:
EventQueueEntry();
~EventQueueEntry();
virtual ~EventQueueEntry();
// nsISupports interface...
NS_DECL_ISUPPORTS
@ -184,6 +186,7 @@ class nsEventQueueServiceImpl : public nsIEventQueueService
{
public:
nsEventQueueServiceImpl();
virtual ~nsEventQueueServiceImpl();
// nsISupports interface...
NS_DECL_ISUPPORTS
@ -201,8 +204,6 @@ public:
#ifdef XP_MAC
NS_IMETHOD ProcessEvents();
#endif // XP_MAC
protected:
~nsEventQueueServiceImpl();
private:
nsHashtable* mEventQTable;