From bc2510c3752146efc44c10c37643ba6b6094de71 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Mon, 12 Nov 2007 11:34:13 +0000 Subject: [PATCH] 2007-11-12 Marcus Brinkmann * kdpipeiodevice.cpp: New version from Frank Osterfeld. --- trunk/gpgme/ChangeLog | 4 ++++ trunk/gpgme/kdpipeiodevice.cpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index dbe43fd..1739e1b 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2007-11-12 Marcus Brinkmann + + * kdpipeiodevice.cpp: New version from Frank Osterfeld. + 2007-10-11 Marcus Brinkmann * kdpipeiodevice.cpp: New version from Frank Osterfeld. diff --git a/trunk/gpgme/kdpipeiodevice.cpp b/trunk/gpgme/kdpipeiodevice.cpp index 67f8bf5..9e0179c 100644 --- a/trunk/gpgme/kdpipeiodevice.cpp +++ b/trunk/gpgme/kdpipeiodevice.cpp @@ -276,7 +276,7 @@ bool KDPipeIODevice::open( int fd, OpenMode mode ) { KDAB_CHECK_THIS; bool KDPipeIODevice::open( Qt::HANDLE h, OpenMode mode ) { KDAB_CHECK_THIS; #ifdef Q_OS_WIN32 - return d->doOpen( 0, h, mode ); + return d->doOpen( -1, h, mode ); #else Q_UNUSED( h ); Q_UNUSED( mode ); @@ -341,12 +341,15 @@ void KDPipeIODevice::Private::emitReadyRead() bool KDPipeIODevice::Private::doOpen( int fd_, Qt::HANDLE handle_, OpenMode mode_ ) { - if ( q->isOpen() || fd_ < 0 ) + if ( q->isOpen() ) return false; #ifdef Q_OS_WIN32 if ( !handle_ ) return false; +#else + if ( fd_ < 0 ) + return false; #endif if ( !(mode_ & ReadWrite) ) @@ -662,8 +665,10 @@ void KDPipeIODevice::close() { KDAB_CHECK_THIS; waitAndDelete( d->reader ); #undef waitAndDelete #ifdef Q_OS_WIN32 - qDebug( "Closing handle" ); - CloseHandle( d->handle ); + if ( d->fd != -1 ) + _close( d->fd ); + else + CloseHandle( d->handle ); #else ::close( d->fd ); #endif -- 2.26.2