Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_rna.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | |||||
| /* Workaround to get the last id without a lookup. */ | /* Workaround to get the last id without a lookup. */ | ||||
| static ID *_id_tmp_ptr; | static ID *_id_tmp_ptr; | ||||
| static void value_id_set(void *id) | static void value_id_set(void *id) | ||||
| { | { | ||||
| _id_tmp_ptr = (ID *)id; | _id_tmp_ptr = (ID *)id; | ||||
| } | } | ||||
| static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash); | static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash); | ||||
| static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject *weakref) | static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref) | ||||
| { | { | ||||
| /* Important to search backwards. */ | /* Important to search backwards. */ | ||||
| GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_capsule, NULL); | GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_pair, NULL); | ||||
| if (BLI_ghash_len(weakinfo_hash) > 1) { | if (BLI_ghash_len(weakinfo_hash) > 1) { | ||||
| BLI_ghash_remove(weakinfo_hash, weakref, NULL, NULL); | BLI_ghash_remove(weakinfo_hash, weakref, NULL, NULL); | ||||
| } | } | ||||
| else { /* Get the last id and free it. */ | else { /* Get the last id and free it. */ | ||||
| BLI_ghash_remove(weakinfo_hash, weakref, NULL, value_id_set); | BLI_ghash_remove(weakinfo_hash, weakref, NULL, value_id_set); | ||||
| id_release_weakref_list(_id_tmp_ptr, weakinfo_hash); | id_release_weakref_list(_id_tmp_ptr, weakinfo_hash); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 8,848 Lines • Show Last 20 Lines | |||||