aboutsummaryrefslogtreecommitdiffstats
path: root/gpgcontext.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-01-15 00:07:33 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-01-15 00:07:33 +0000
commitd4beca1326709b5663ff908b7558ca100994b42b (patch)
treecb240418e84ebcb265607a015e8c34fbab680b5f /gpgcontext.cpp
parentadded flipped logo to wizard (diff)
downloadgpg4usb-d4beca1326709b5663ff908b7558ca100994b42b.tar.gz
gpg4usb-d4beca1326709b5663ff908b7558ca100994b42b.zip
fix cancel bug on windows. yay ! :) . thanx to sylphed-sources for the pointer to CloseHandle()
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@739 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgcontext.cpp')
-rw-r--r--gpgcontext.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp
index 1dd01ff..52d493d 100644
--- a/gpgcontext.cpp
+++ b/gpgcontext.cpp
@@ -467,6 +467,10 @@ gpgme_error_t GpgContext::passphrase(const char *uid_hint,
QString passwordDialogMessage;
QString gpgHint = uid_hint;
bool result;
+#ifdef _WIN32
+ DWORD written;
+ HANDLE hd = (HANDLE)fd;
+#endif
if (last_was_bad) {
passwordDialogMessage += "<i>"+tr("Wrong password")+".</i><br><br>\n\n";
@@ -497,11 +501,10 @@ gpgme_error_t GpgContext::passphrase(const char *uid_hint,
qDebug() << "something is terribly broken";
}
#else
- DWORD written;
- WriteFile((HANDLE) fd, mPasswordCache.data(), mPasswordCache.length(), &written, 0);
+ WriteFile(hd, mPasswordCache.data(), mPasswordCache.length(), &written, 0);
#endif
- returnValue = 0;
+ returnValue = GPG_ERR_NO_ERROR;
}
#ifndef _WIN32
@@ -509,8 +512,12 @@ gpgme_error_t GpgContext::passphrase(const char *uid_hint,
qDebug() << "something is terribly broken";
}
#else
- DWORD written;
- WriteFile((HANDLE) fd, "\n", 1, &written, 0);
+ WriteFile(hd, "\n", 1, &written, 0);
+
+ /* program will hang on cancel if hd not closed */
+ if(!result) {
+ CloseHandle(hd);
+ }
#endif
return returnValue;