Allow destruction of QWinEventNotifier in its signal
Avoid use-after-free issue in QProcess. Fixes: QTBUG-96285 Fixes: QTBUG-96359 Change-Id: I953d7a8ecaf301ec3a27db37e13748f905c3d097 Reviewed-by: Christoph Cullmann <cullmann@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 4e0082a9cacfdfd0c43e6105274bc0d41dd18801)
This commit is contained in:
parent
866ceb7eb4
commit
c5a79d6dbc
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include "qcoreapplication.h"
|
#include "qcoreapplication.h"
|
||||||
#include "qthread.h"
|
#include "qthread.h"
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -228,9 +229,10 @@ bool QWinEventNotifier::event(QEvent * e)
|
|||||||
== QWinEventNotifierPrivate::Posted && d->enabled) {
|
== QWinEventNotifierPrivate::Posted && d->enabled) {
|
||||||
d->unregisterWaitObject();
|
d->unregisterWaitObject();
|
||||||
|
|
||||||
|
QPointer<QWinEventNotifier> alive(this);
|
||||||
emit activated(d->handleToEvent, QPrivateSignal());
|
emit activated(d->handleToEvent, QPrivateSignal());
|
||||||
|
|
||||||
if (d->enabled && d->waitHandle == NULL)
|
if (alive && d->enabled && d->waitHandle == NULL)
|
||||||
d->registerWaitObject();
|
d->registerWaitObject();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user