summaryrefslogtreecommitdiff
path: root/ace/Module.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-30 00:33:43 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-30 00:33:43 +0000
commit2d27f44666189e87ff27436b35a0dd002a0cdfd7 (patch)
treedd496dde3c016a1db5d3882e1dc40c9af7e9aaf8 /ace/Module.cpp
parent8460f65dd042d52eaaa80acfef7f288ab4ceb27a (diff)
downloadATCD-2d27f44666189e87ff27436b35a0dd002a0cdfd7.tar.gz
Eon
Diffstat (limited to 'ace/Module.cpp')
-rw-r--r--ace/Module.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/ace/Module.cpp b/ace/Module.cpp
index 9471de5cc8e..35db70ee7ac 100644
--- a/ace/Module.cpp
+++ b/ace/Module.cpp
@@ -109,8 +109,10 @@ template <ACE_SYNCH_1> ACE_INLINE
ACE_Module<ACE_SYNCH_2>::~ACE_Module (void)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_2>::~ACE_Module");
- ACE_ERROR ((LM_ERROR, "destructor for %s should never be called!\n",
- this->name ()));
+
+ // Only close down if we haven't already done so.
+ if (this->reader () != 0 || this->writer () != 0)
+ this->close ();
}
template <ACE_SYNCH_1> ACE_INLINE
@@ -154,14 +156,14 @@ ACE_Module<ACE_SYNCH_2>::close (u_long flags)
// running in them.
if (reader_q->thr_count () == 0)
delete reader_q;
- this->reader (0);
-
if (writer_q->thr_count () == 0)
delete writer_q;
- this->writer (0);
-
- delete (void *) this; // Darn well better be allocated dynamically!!!
}
+
+ // Set the reader and writers to NULL so that we don't try to close()
+ // this object again if the destructor gets called.
+ this->reader (0);
+ this->writer (0);
return result;
}