on xenial help sign in
Cancel open PAM interactions on shutdown - fixes hang on logout on desktop
commit93a0254dc670bfe108696f7066c2030472ace649 authorGerry Boland <gerry.boland@canonical.com> dateFri 15 Aug 2014, 10:33 (12 years ago) parent5613e47
1 file changed+18−8
tests/mocks/LightDM/demo/GreeterPrivate.cpp+18−8
tests/mocks/LightDM/demo/GreeterPrivate.cpp+18−8
@@ -53,16 +53,15 @@ public:
5353 this, SLOT(handlePrompt(QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)));
5454 }
5555
56+ ~GreeterImpl()
57+ {
58+ cancelPam();
59+ }
60+
5661 void start(QString username)
5762 {
58− // Clear out any existing PAM interactions first (we can't simply
59− // cancel our QFuture because QtConcurrent::run doesn't support cancel)
60− if (pamHandle != NULL) {
61− pam_handle *handle = pamHandle;
62− pamHandle = NULL; // to disable normal finishPam() handling
63− while (respond(QString())); // clear our local queue of QFutures
64− pam_end(handle, PAM_CONV_ERR);
65− }
63+ // Clear out any existing PAM interactions first
64+ cancelPam();
6665
6766 // Now actually start a new conversation with PAM
6867 pam_conv conversation;
@@ -212,6 +211,17 @@ private Q_SLOTS:
212211 }
213212
214213private:
214+ void cancelPam()
215+ {
216+ // Unfortunately we can't simply cancel our QFuture because QtConcurrent::run doesn't support cancel
217+ if (pamHandle != NULL) {
218+ pam_handle *handle = pamHandle;
219+ pamHandle = NULL; // to disable normal finishPam() handling
220+ while (respond(QString())); // clear our local queue of QFutures
221+ pam_end(handle, PAM_CONV_ERR);
222+ }
223+ }
224+
215225 Greeter *greeter;
216226 GreeterPrivate *greeterPrivate;
217227 pam_handle* pamHandle;