Skip to content

Commit 9f1af1e

Browse files
usiemsjcfr
authored andcommitted
[Backport] 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. (cherry picked from commit MeVisLab/pythonqt@b5a88e1)
1 parent 15c3946 commit 9f1af1e

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
@@ -270,9 +270,9 @@ int PythonQtSignalReceiver::qt_metacall(QMetaObject::Call c, int id, void **argu
270270
bool shouldDelete = false;
271271
for(const PythonQtSignalTarget& t : _targets) {
272272
if (t.slotId() == id) {
273+
const int sigId = t.signalId();
273274
t.call(arguments);
274275
// if the signal is the last destroyed signal, we delete ourselves
275-
int sigId = t.signalId();
276276
if ((sigId == _destroyedSignal1Id) || (sigId == _destroyedSignal2Id)) {
277277
_destroyedSignalCount--;
278278
if (_destroyedSignalCount == 0) {

0 commit comments

Comments
 (0)