H
Hitesh Bhatiya
Hi all,
I have written a small program to accept some socket connections, which are
then added to a vector (using push_back). But after a few calls to the
push_back function, it deleted the object that was added last.
Could someone please tell me why this happens ? Am I doing something wrong
here ?
[code fragment]
SocketClient* newSock=new SocketClient(_sock);
connections.push_back(*newSock);
[end code fragement]
[stack trace]
=>[1] SocketClient::~SocketClient(this = 0x31ac38), line 18 in
"SocketClient.C"
[2] __rwstd::__destroy<SocketClient>(pointer = 0x31ac38), line 184 in
"memory"
[3]
std::allocator_interface<std::allocator<SocketClient>,SocketClient>::destroy
(this = 0xfe909b2f, p = 0x31ac38), line 520 in "memory"
"ConnectionHandler.C"
[8] threadEntryPoint(thread = 0xffbefa30), line 10 in "Thread.C"
[end stack trace]
Other info:
$ uname -X
System = SunOS
Node = bb18
Release = 5.8
KernelID = Generic_108528-20
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 1
$ CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
Thanks.
I have written a small program to accept some socket connections, which are
then added to a vector (using push_back). But after a few calls to the
push_back function, it deleted the object that was added last.
Could someone please tell me why this happens ? Am I doing something wrong
here ?
[code fragment]
SocketClient* newSock=new SocketClient(_sock);
connections.push_back(*newSock);
[end code fragement]
[stack trace]
=>[1] SocketClient::~SocketClient(this = 0x31ac38), line 18 in
"SocketClient.C"
[2] __rwstd::__destroy<SocketClient>(pointer = 0x31ac38), line 184 in
"memory"
[3]
std::allocator_interface<std::allocator<SocketClient>,SocketClient>::destroy
(this = 0xfe909b2f, p = 0x31ac38), line 520 in "memory"
in "vector"[4] std::vector said:::__destroy(this = 0x2209c4, start = 0x31ac48, finish = 0x31ac68), line 147
in "vector.cc"[5] std::vector said:::__insert_aux(this = 0x2209c4, position = 0x31ac68, x = CLASS), line 141
[7] ConnectionHandler::run(this = 0xffbefa30), line 73 in[6] std::vector said::ush_back(this = 0x2209c4, x = CLASS), line 467 in "vector"
"ConnectionHandler.C"
[8] threadEntryPoint(thread = 0xffbefa30), line 10 in "Thread.C"
[end stack trace]
Other info:
$ uname -X
System = SunOS
Node = bb18
Release = 5.8
KernelID = Generic_108528-20
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 1
$ CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
Thanks.