.animate helper: create and start an animation directly on a target. Preferred use pattern; closes #175
This commit is contained in:
parent
d878c8684d
commit
9ab618079a
21 changed files with 738 additions and 11 deletions
|
|
@ -40,17 +40,18 @@ Animation::Animation(const std::string& targetProperty,
|
|||
|
||||
Animation::~Animation() {
|
||||
// Decrease reference count for Python callback if we still own it
|
||||
// Guard with Py_IsInitialized() because destructor may run during interpreter shutdown
|
||||
PyObject* callback = pythonCallback;
|
||||
if (callback) {
|
||||
if (callback && Py_IsInitialized()) {
|
||||
pythonCallback = nullptr;
|
||||
|
||||
|
||||
PyGILState_STATE gstate = PyGILState_Ensure();
|
||||
Py_DECREF(callback);
|
||||
PyGILState_Release(gstate);
|
||||
}
|
||||
|
||||
// Clean up cache entry
|
||||
if (serial_number != 0) {
|
||||
|
||||
// Clean up cache entry (also guard - PythonObjectCache may use Python)
|
||||
if (serial_number != 0 && Py_IsInitialized()) {
|
||||
PythonObjectCache::getInstance().remove(serial_number);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue