Skip to content

Commit b5a88e1

Browse files
committed
Fix a possible invalid memory access
This could happen if the signal target was removed in the callback, which could lead to an invalid signalId being returned. I guess this could lead to the signal receiver destroyed out of turn.
1 parent d0ca7a1 commit b5a88e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PythonQtSignalReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ int PythonQtSignalReceiver::qt_metacall(QMetaObject::Call c, int id, void **argu
262262
bool shouldDelete = false;
263263
for(const PythonQtSignalTarget& t : _targets) {
264264
if (t.slotId() == id) {
265+
const int sigId = t.signalId();
265266
t.call(arguments);
266267
// if the signal is the last destroyed signal, we delete ourselves
267-
int sigId = t.signalId();
268268
if ((sigId == _destroyedSignal1Id) || (sigId == _destroyedSignal2Id)) {
269269
_destroyedSignalCount--;
270270
if (_destroyedSignalCount == 0) {

0 commit comments

Comments
 (0)