Skip to content

Commit eebf08d

Browse files
mrbean-bremenjcfr
authored andcommitted
[Backport] Add missing GIL scope to single shot timer destructor
- provided by Florian Link (cherry picked from commit MeVisLab/pythonqt@89983a0)
1 parent 0af4a14 commit eebf08d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/PythonQtStdDecorators.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,19 @@ PythonQtSingleShotTimer::PythonQtSingleShotTimer(int msec, const PythonQtObjectP
432432
connect(this, SIGNAL(timeout()), this, SLOT(slotTimeout()));
433433
}
434434

435+
PythonQtSingleShotTimer::~PythonQtSingleShotTimer()
436+
{
437+
PYTHONQT_GIL_SCOPE
438+
_callable = nullptr;
439+
}
440+
435441
void PythonQtSingleShotTimer::slotTimeout()
436442
{
437443
if (_callable) {
444+
PYTHONQT_GIL_SCOPE
438445
_callable.call();
439446
}
440447
// delete ourself
441448
deleteLater();
442449
}
450+

src/PythonQtStdDecorators.h

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class PythonQtSingleShotTimer : public QTimer
124124
Q_OBJECT
125125
public:
126126
PythonQtSingleShotTimer(int msec, const PythonQtObjectPtr& callable);
127+
~PythonQtSingleShotTimer() override;
127128

128129
public Q_SLOTS :
129130
void slotTimeout();

0 commit comments

Comments
 (0)