summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-05-23 11:15:53 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-05-24 09:20:49 +0900
commit4044fe650469d6b5910b62692236487630d8db9a (patch)
treebb5c3ab98e8a30ff3182819cb66381dd4f0e11c7
parentb8b41e668394be9ac84ddff6de8110dc275b88f8 (diff)
eo - now ref and unref objects on each eo call to keep things safe
so... i got this ... callback calls callback calls something calls callback that deletes the original object at the top so when it comes back ... things die as the object was destructed. in removing eo_do() we removed the ref/unrefs that went with it. so this uses the _EO_API_BEFORE_HOOK and _EO_API_AFTER_HOOK to call exposed "internal" public functions _eo_real_ref() and _eo_real_unref(). this fixes a new segv i've noticed in several e dialogs where hitting close does the above via callbacks and closes the window etc.
-rw-r--r--src/lib/eo/Eo.h7
-rw-r--r--src/lib/eo/eo.c12
2 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 61af39bc1b..46eb183602 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -560,8 +560,11 @@ typedef struct _Eo_Call_Cache
560 __FILE__, __LINE__)) return DefRet; \ 560 __FILE__, __LINE__)) return DefRet; \
561 _Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func; \ 561 _Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func; \
562 562
563#define _EO_API_BEFORE_HOOK 563EAPI void _eo_real_ref(_Eo_Object *obj);
564#define _EO_API_AFTER_HOOK 564EAPI void _eo_real_unref(_Eo_Object *obj);
565
566#define _EO_API_BEFORE_HOOK _eo_real_ref(___call.obj);
567#define _EO_API_AFTER_HOOK _eo_real_unref(___call.obj);
565#define _EO_API_CALL_HOOK(x) x 568#define _EO_API_CALL_HOOK(x) x
566 569
567// to define an EAPI function 570// to define an EAPI function
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 8ff5f4ac27..8c0023faa5 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1421,6 +1421,18 @@ eo_xunref(Eo *obj_id, const Eo *ref_obj_id)
1421 _eo_unref(obj); 1421 _eo_unref(obj);
1422} 1422}
1423 1423
1424EAPI void
1425_eo_real_ref(_Eo_Object *obj)
1426{
1427 if (obj) _eo_ref(obj);
1428}
1429
1430EAPI void
1431_eo_real_unref(_Eo_Object *obj)
1432{
1433 if (obj) _eo_unref(obj);
1434}
1435
1424EAPI Eo * 1436EAPI Eo *
1425eo_ref(const Eo *obj_id) 1437eo_ref(const Eo *obj_id)
1426{ 1438{