@@ -18,6 +18,7 @@
19#include "Greeter.h"
19#include "Greeter.h"
20#include "GreeterPrivate.h"
20#include "GreeterPrivate.h"
21+#include <QCoreApplication>
21#include <QFuture>
22#include <QFuture>
22#include <QFutureInterface>
23#include <QFutureInterface>
23#include <QFutureWatcher>
24#include <QFutureWatcher>
@@ -50,6 +51,10 @@ public:
51 qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
52 qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
54+ // Don't get stuck waiting for PAM as we shut down.
55+ connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
56+ this, &GreeterImpl::cancelPam);
53 connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam);
58 connect(&futureWatcher, &QFutureWatcher<int>::finished, this, &GreeterImpl::finishPam);
54 connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
59 connect(this, SIGNAL(showMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)),
55 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
60 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
@@ -246,7 +251,6 @@ private Q_SLOTS:
246 Q_EMIT greeter->showPrompt(text, type);
251 Q_EMIT greeter->showPrompt(text, type);
250 void cancelPam()
254 void cancelPam()
252 if (pamHandle != nullptr) {
256 if (pamHandle != nullptr) {
@@ -269,6 +273,7 @@ private:
272 Greeter *greeter;
277 Greeter *greeter;
273 GreeterPrivate *greeterPrivate;
278 GreeterPrivate *greeterPrivate;
274 pam_handle* pamHandle;
279 pam_handle* pamHandle;