~aacid/unity8/doubleClickMaximize

« back to all changes in this revision

Viewing changes to plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp

  • Committer: Albert Astals Cid
  • Date: 2017-01-31 14:12:16 UTC
  • mfrom: (2768.2.18 unity8.overflow)
  • Revision ID: albert.astals@canonical.com-20170131141216-uztd1cf58ztzruph
MergeĀ ~nick-dedekind/unity8/menu.overflow

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        }
207
207
    }
208
208
 
 
209
    void cancelPam()
 
210
    {
 
211
        if (pamHandle != nullptr) {
 
212
            QFuture<int> pamFuture = futureWatcher.future();
 
213
            pam_handle *handle = pamHandle;
 
214
            pamHandle = nullptr; // to disable normal finishPam() handling
 
215
            pamFuture.cancel();
 
216
 
 
217
            // Note the empty loop, we just want to clear the futures queue.
 
218
            // Any further prompts from the pam thread will be immediately
 
219
            // responded to/dismissed in handlePrompt().
 
220
            while (respond(QString()));
 
221
 
 
222
            // Now let signal/slot handling happen so the thread can finish
 
223
            while (!pamFuture.isFinished()) {
 
224
                QCoreApplication::processEvents();
 
225
            }
 
226
 
 
227
            pam_end(handle, PAM_CONV_ERR);
 
228
        }
 
229
    }
 
230
 
209
231
Q_SIGNALS:
210
232
    void showMessage(pam_handle *handle, QString text, QLightDM::Greeter::MessageType type);
211
233
    void showPrompt(pam_handle *handle, QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture response);
247
269
    }
248
270
 
249
271
private:
250
 
    void cancelPam()
251
 
    {
252
 
        if (pamHandle != nullptr) {
253
 
            QFuture<int> pamFuture = futureWatcher.future();
254
 
            pam_handle *handle = pamHandle;
255
 
            pamHandle = nullptr; // to disable normal finishPam() handling
256
 
            pamFuture.cancel();
257
 
 
258
 
            // Note the empty loop, we just want to clear the futures queue.
259
 
            // Any further prompts from the pam thread will be immediately
260
 
            // responded to/dismissed in handlePrompt().
261
 
            while (respond(QString()));
262
 
 
263
 
            // Now let signal/slot handling happen so the thread can finish
264
 
            while (!pamFuture.isFinished()) {
265
 
                QCoreApplication::processEvents();
266
 
            }
267
 
 
268
 
            pam_end(handle, PAM_CONV_ERR);
269
 
        }
270
 
    }
271
 
 
272
272
    Greeter *greeter;
273
273
    GreeterPrivate *greeterPrivate;
274
274
    pam_handle* pamHandle;
299
299
    m_impl->respond(response);
300
300
}
301
301
 
 
302
void GreeterPrivate::cancelAuthentication()
 
303
{
 
304
    m_impl->cancelPam();
 
305
}
 
306
 
302
307
}
303
308
 
304
309
#include "GreeterPrivate.moc"