summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-20 02:03:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-20 02:03:19 +0000
commit8ff2829c737b268a10b049c87cd9e62321207472 (patch)
treec262f338289c07b040eac932d627cde09c55a511
parent1d558b0bda448c839f784a5dfa208782f90972f6 (diff)
downloadtdebase-8ff2829c.tar.gz
tdebase-8ff2829c.zip
Prevent a Qt race condition where the dialog can be tested as existing, then the dialog pointer can be set to NULL by a dialog internal exit before a subsequent dialog call executes.
Essentially these patches lock out the dialog pointer reset until the subsequent dialog call completes after the dialog exist check. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1116662 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--kdesktop/lock/lockprocess.cc18
-rw-r--r--kdesktop/lock/lockprocess.h1
2 files changed, 17 insertions, 2 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 685864d10..ecad13177 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -137,7 +137,8 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
mPipeOpen(false),
mPipeOpen_out(false),
mInfoMessageDisplayed(false),
- mForceReject(false)
+ mForceReject(false),
+ mDialogControLock(false);
{
setupSignals();
setupPipe();
@@ -293,20 +294,24 @@ void LockProcess::checkPipe()
if (numread > 0) {
if (readbuf[0] == 'C') {
mInfoMessageDisplayed=false;
+ mDialogControLock = true;
if (currentDialog != NULL) {
mForceReject = true;
currentDialog->close();
}
+ mDialogControLock = false;
}
if (readbuf[0] == 'T') {
to_display = readbuf;
to_display = to_display.remove(0,1);
// Lock out password dialogs and close any active dialog
mInfoMessageDisplayed=true;
+ mDialogControLock = true;
if (currentDialog != NULL) {
mForceReject = true;
currentDialog->close();
}
+ mDialogControLock = false;
// Display info message dialog
QTimer::singleShot( PIPE_CHECK_INTERVAL, this, SLOT(checkPipe()) );
InfoDlg inDlg( this );
@@ -321,10 +326,12 @@ void LockProcess::checkPipe()
to_display = to_display.remove(0,1);
// Lock out password dialogs and close any active dialog
mInfoMessageDisplayed=true;
+ mDialogControLock = true;
if (currentDialog != NULL) {
mForceReject = true;
currentDialog->close();
}
+ mDialogControLock = false;
// Display info message dialog
QTimer::singleShot( PIPE_CHECK_INTERVAL, this, SLOT(checkPipe()) );
InfoDlg inDlg( this );
@@ -342,10 +349,12 @@ void LockProcess::checkPipe()
to_display = to_display.remove(0,1);
// Lock out password dialogs and close any active dialog
mInfoMessageDisplayed=true;
+ mDialogControLock = true;
if (currentDialog != NULL) {
mForceReject = true;
currentDialog->close();
}
+ mDialogControLock = false;
// Display query dialog
QTimer::singleShot( PIPE_CHECK_INTERVAL, this, SLOT(checkPipe()) );
QueryDlg qryDlg( this );
@@ -646,10 +655,12 @@ void LockProcess::createSaverWindow()
void LockProcess::desktopResized()
{
+ mDialogControLock = true;
if (currentDialog != NULL) {
mForceReject = true;
currentDialog->close();
}
+ mDialogControLock = false;
// Get root window size
XWindowAttributes rootAttr;
@@ -1142,6 +1153,10 @@ int LockProcess::execDialog( QDialog *dlg )
mDialogs.prepend( dlg );
fakeFocusIn( dlg->winId());
int rt = dlg->exec();
+ while (mDialogControLock == true) {
+ sleep(1);
+ }
+ currentDialog = NULL;
mDialogs.remove( dlg );
if( mDialogs.isEmpty() ) {
XChangeActivePointerGrab( qt_xdisplay(), GRABEVENTS,
@@ -1149,7 +1164,6 @@ int LockProcess::execDialog( QDialog *dlg )
resume( false );
} else
fakeFocusIn( mDialogs.first()->winId());
- currentDialog = NULL;
return rt;
}
diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h
index ee1621bc8..91d7658b2 100644
--- a/kdesktop/lock/lockprocess.h
+++ b/kdesktop/lock/lockprocess.h
@@ -135,6 +135,7 @@ private:
bool mAutoLogout;
bool mInfoMessageDisplayed;
QDialog *currentDialog;
+ bool mDialogControLock;
bool mForceReject;
bool mPipeOpen;