From 10e7e45ae92d4fe06f70126ed256b87896dbc432 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 29 Oct 2008 19:46:57 +0000 Subject: better solution to add possibility to delete eSocketNotifiers, eConsoleAppContainers in callback funktions without crash --- lib/python/Plugins/Extensions/SocketMMI/src/socket_mmi.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'lib/python/Plugins/Extensions/SocketMMI/src/socket_mmi.cpp') diff --git a/lib/python/Plugins/Extensions/SocketMMI/src/socket_mmi.cpp b/lib/python/Plugins/Extensions/SocketMMI/src/socket_mmi.cpp index 36ce9f40..673b525c 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/src/socket_mmi.cpp +++ b/lib/python/Plugins/Extensions/SocketMMI/src/socket_mmi.cpp @@ -129,7 +129,7 @@ int eSocketMMIHandler::send_to_mmisock( void* buf, size_t len) } eSocketMMIHandler::eSocketMMIHandler() - :buffer(512), connfd(-1), connsn(0), sockname("/tmp/mmi.socket"), name(0) + :buffer(512), connfd(-1), sockname("/tmp/mmi.socket"), name(0) { memset(&servaddr, 0, sizeof(struct sockaddr_un)); servaddr.sun_family = AF_UNIX; @@ -154,7 +154,7 @@ eSocketMMIHandler::eSocketMMIHandler() else if (listen(listenfd, 0) == -1) eDebug("[eSocketMMIHandler] listen (%m)"); else { - listensn = new eSocketNotifier( eApp, listenfd, POLLIN ); + listensn = eSocketNotifier::create( eApp, listenfd, POLLIN ); listensn->start(); CONNECT( listensn->activated, eSocketMMIHandler::listenDataAvail ); eDebug("[eSocketMMIHandler] created successfully"); @@ -186,7 +186,7 @@ void eSocketMMIHandler::listenDataAvail(int what) else if (fcntl(connfd, F_SETFL, val | O_NONBLOCK) == -1) eDebug("[eSocketMMIHandler] F_SETFL (%m)"); else { - connsn = new eSocketNotifier( eApp, connfd, POLLIN|POLLHUP|POLLERR ); + connsn = eSocketNotifier::create( eApp, connfd, POLLIN|POLLHUP|POLLERR ); CONNECT( connsn->activated, eSocketMMIHandler::connDataAvail ); return; } @@ -294,11 +294,7 @@ void eSocketMMIHandler::closeConn() close(connfd); connfd=-1; } - if ( connsn ) - { - delete connsn; - connsn=0; - } + connsn=0; if ( name ) { delete [] name; @@ -309,7 +305,6 @@ void eSocketMMIHandler::closeConn() eSocketMMIHandler::~eSocketMMIHandler() { closeConn(); - delete listensn; unlink(sockname); } -- cgit v1.2.3