mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kdesudo: terminate the process from KdeSudo destructor
the process is not detached thus it will happen one way or other but doing it from the KdeSudo destructor with 3sec wait time for the process to terminate will silence the QProcess runtime warning (possibly, unless the process does not quit on SIGTERM or within 3 seconds) Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
cea6fb2142
commit
63c440a6d3
1 changed files with 6 additions and 2 deletions
|
@ -74,7 +74,7 @@ KdeSudo::KdeSudo(const QString &icon, const QString &appname)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dialog = new KPasswordDialog;
|
m_dialog = new KPasswordDialog();
|
||||||
m_dialog->setDefaultButton(KDialog::Ok);
|
m_dialog->setDefaultButton(KDialog::Ok);
|
||||||
|
|
||||||
if (attach) {
|
if (attach) {
|
||||||
|
@ -82,7 +82,7 @@ KdeSudo::KdeSudo(const QString &icon, const QString &appname)
|
||||||
KWindowSystem::setMainWindow(m_dialog, (WId)winid);
|
KWindowSystem::setMainWindow(m_dialog, (WId)winid);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_process = new QProcess;
|
m_process = new QProcess(this);
|
||||||
|
|
||||||
/* load the icon */
|
/* load the icon */
|
||||||
m_dialog->setPixmap(icon);
|
m_dialog->setPixmap(icon);
|
||||||
|
@ -275,6 +275,10 @@ KdeSudo::~KdeSudo()
|
||||||
{
|
{
|
||||||
delete m_dialog;
|
delete m_dialog;
|
||||||
delete m_cookie;
|
delete m_cookie;
|
||||||
|
if (m_process) {
|
||||||
|
m_process->terminate();
|
||||||
|
m_process->waitForFinished(3000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KdeSudo::error(const QString &msg)
|
void KdeSudo::error(const QString &msg)
|
||||||
|
|
Loading…
Add table
Reference in a new issue