Fix double free in DummyConnectionServer

Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
This commit is contained in:
Vladimír Matěna 2016-09-10 22:48:30 +02:00 committed by Vitaly Takmazov
parent 2e750697d7
commit 0729d364ca
2 changed files with 2 additions and 5 deletions

View file

@ -30,8 +30,7 @@ void DummyConnectionServer::stop() {
void DummyConnectionServer::acceptConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> connection) {
eventLoop->postEvent(
boost::bind(boost::ref(onNewConnection), connection),
SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<DummyConnectionServer>(this));
boost::bind(boost::ref(onNewConnection), connection));
// connection->listen();
}

View file

@ -19,10 +19,8 @@
#include "Swiften/SwiftenCompat.h"
namespace Swift {
class DummyConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<DummyConnectionServer> {
class DummyConnectionServer : public ConnectionServer {
public:
typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<DummyConnectionServer> ref;
enum Error {
Conflict,
UnknownError