Ok, your problem is that the TCPSession::final calls delete this when
the thread ends.
Your choices are
1) Dont call tcp->detach(), call start()... the thread will be deleted
automaticall by TCPSession::final
2) override virtual void final() in TCPSessionThread, to do nothing.
For the library, TCPSession::final should say if(!isDetached()) delete
this;
Rami Saarinen wrote:
--- Nick Liebmann <address@hidden> wrote:
I would also suggest declaring empty virtual destructors for any
inherited classes for which you have no specific
need for a destructor. I dont really know why this should be
necessary, but for some reason (at least in the past)
I have found this necessary, and now do it as a habit.
An isolated test-case is definitly the way to go!
Well I just can't get it any simpler than this. Invalid pointer is still
present exactly like before. Am I missing something? Brains?
I am using cc++ 1.3.1, gcc 3.3.3 20040412, Fedora Core 2 (Linux). cc++
was
compiled on this machine.
testlistener is the test program.
TCPListener is the one that will create TCPSessionThread per connection
when there are connections pending.
TCPSessionThread does nothing at all (and the invalid pointer error
appears in destructor).
I linked it with -lccgnu2 -ldl (used also -lpthread, but it is not
needed
really).
Valgrind gives this when connecting the test program and sending some
text
to it:
_______________________________________________
Bug-commoncpp mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-commoncpp