kdeui: initialize variable in KDialogQueue::Private::slotShowQueuedDialog()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-29 04:03:57 +03:00
parent e555f8ce9b
commit 1f67d424e7

View file

@ -1072,8 +1072,8 @@ public:
KDialogQueue* KDialogQueue::self() KDialogQueue* KDialogQueue::self()
{ {
K_GLOBAL_STATIC(KDialogQueue, _self) K_GLOBAL_STATIC(KDialogQueue, _self)
return _self; return _self;
} }
KDialogQueue::KDialogQueue() KDialogQueue::KDialogQueue()
@ -1083,38 +1083,41 @@ KDialogQueue::KDialogQueue()
KDialogQueue::~KDialogQueue() KDialogQueue::~KDialogQueue()
{ {
delete d; delete d;
} }
// static // static
void KDialogQueue::queueDialog( QDialog *dialog ) void KDialogQueue::queueDialog(QDialog *dialog)
{ {
KDialogQueue *_this = self(); KDialogQueue *_this = self();
_this->d->queue.append( dialog ); _this->d->queue.append(dialog);
QTimer::singleShot( 0, _this, SLOT(slotShowQueuedDialog()) ); QTimer::singleShot(0, _this, SLOT(slotShowQueuedDialog()));
} }
void KDialogQueue::Private::slotShowQueuedDialog() void KDialogQueue::Private::slotShowQueuedDialog()
{ {
if ( busy ) if (busy) {
return; return;
}
QDialog *dialog; QDialog *dialog = nullptr;
do { do {
if ( queue.isEmpty() ) if (queue.isEmpty()) {
return; return;
dialog = queue.first(); }
queue.pop_front(); dialog = queue.first();
} while( !dialog ); queue.pop_front();
} while(!dialog);
busy = true; busy = true;
dialog->exec(); dialog->exec();
busy = false; busy = false;
delete dialog; delete dialog;
if ( !queue.isEmpty() ) if (!queue.isEmpty()) {
QTimer::singleShot( 20, q, SLOT(slotShowQueuedDialog()) ); QTimer::singleShot(20, q, SLOT(slotShowQueuedDialog()));
}
} }
#include "moc_kdialog.cpp" #include "moc_kdialog.cpp"