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
v3.5.13-sru
tpearson 14 years ago
parent 1d558b0bda
commit 8ff2829c73

@ -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;
}

@ -135,6 +135,7 @@ private:
bool mAutoLogout;
bool mInfoMessageDisplayed;
QDialog *currentDialog;
bool mDialogControLock;
bool mForceReject;
bool mPipeOpen;

Loading…
Cancel
Save