summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-03-02 22:53:10 (UTC)
committer mickeyl <mickeyl>2003-03-02 22:53:10 (UTC)
commitaffe85499e4650076bcd6058c18ba44d9a6117be (patch) (side-by-side diff)
treeb787f542e183b58d9f2b75f376f3c3bc5d5fa3d3
parentab5f21907fb482d35f8aebe4505e954d3c22f3c7 (diff)
downloadopie-affe85499e4650076bcd6058c18ba44d9a6117be.zip
opie-affe85499e4650076bcd6058c18ba44d9a6117be.tar.gz
opie-affe85499e4650076bcd6058c18ba44d9a6117be.tar.bz2
fix "segfault-on-close" bug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index dd8a365..09a44e6 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -85,78 +85,73 @@ Wellenreiter::Wellenreiter( QWidget* parent )
//
#ifdef QWS
QString sys;
sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
_system = ODevice::inst()->system();
logwindow->log( sys );
#endif
//
// setup socket for daemon communication, register socket notifier
//
// struct sockaddr_in sockaddr;
daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr );
if ( daemon_fd == -1 )
{
logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
}
else
{
int flags;
flags = fcntl( daemon_fd, F_GETFL, 0 );
fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK );
- QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent );
+ QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, this );
connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) );
}
// setup GUI
netview->setColumnWidthMode( 1, QListView::Manual );
if ( manufacturerdb )
netview->setManufacturerDB( manufacturerdb );
}
Wellenreiter::~Wellenreiter()
{
// no need to delete child widgets, Qt does it all for us
delete manufacturerdb;
- // X11-only - Hmm... Closing the socket here segfaults on exit,
- // Maybe because the notifier still has a handle to it!? Seems not to
- // occur on Qt/Embedded
-
- #ifdef QWS
if ( daemon_fd != -1 )
{
qDebug( "closing comm socket" );
- close( daemon_fd );
+ ::shutdown( daemon_fd, 0 );
+ ::close( daemon_fd );
+ qDebug( "comm socket closed." );
}
- #endif
-
}
void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
{
configwindow = cw;
}
void Wellenreiter::handleMessage()
{
// FIXME: receive message and handle it
qDebug( "received message from daemon." );
/*char buffer[10000];
memset( &buffer, 0, sizeof( buffer ) );*/
char buffer[WL_SOCKBUF];
// int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) );
/*
struct sockaddr from;
socklen_t len;