Skip to content

Commit 892be2b

Browse files
committed
Fix crash when using directors in Python without limited API
Call correct functions when unlocking/destroying a mutex implemented using Python API: they were accidentally exchanged in 21f1c92 (Make directors implementation for Python work with limited API, 2019-12-23) resulting in crashes when using directors and threads together. Closes swig#2889, swig#3112.
1 parent c67582d commit 892be2b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGES.current

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
77
Version 4.4.0 (in progress)
88
===========================
99

10+
2025-01-27: StefanBattmer
11+
[Python] #2889 Fix regression when using directors and threads
12+
but not using limited API.
13+
1014
2024-12-07: arbrauns
1115
[Lua] #3083 Fix "unsigned long long" being interpreted as "signed
1216
long long".

Lib/python/director_py_mutex.swg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ namespace Swig {
1616
PyThread_type_lock mutex_;
1717
public:
1818
Mutex() : mutex_(PyThread_allocate_lock()) {}
19-
~Mutex() { PyThread_release_lock(mutex_); }
19+
~Mutex() { PyThread_free_lock(mutex_); }
2020
void lock() { PyThread_acquire_lock(mutex_, WAIT_LOCK); }
21-
void unlock() { PyThread_free_lock(mutex_); }
21+
void unlock() { PyThread_release_lock(mutex_); }
2222
};
2323
}
2424
#endif

0 commit comments

Comments
 (0)