forked from enlightenment/efl
parent
62efa76e50
commit
42e460e3b6
|
@ -82,3 +82,6 @@
|
|||
* Added eina_binbuf: This is just like strbuf but for binary blobs.
|
||||
Requested by discomfitor and honestly it looks needed.
|
||||
|
||||
2011-05-18 Cedric Bail
|
||||
|
||||
* Fix eina_share_common_init to be called only once.
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
static const char EINA_MAGIC_SHARE_STR[] = "Eina Share";
|
||||
static const char EINA_MAGIC_SHARE_HEAD_STR[] = "Eina Share Head";
|
||||
|
||||
static int _eina_share_common_count = 0;
|
||||
|
||||
#define EINA_MAGIC_CHECK_SHARE_COMMON_HEAD(d, unlock, ...) \
|
||||
do { \
|
||||
|
@ -599,9 +600,12 @@ eina_share_common_init(Eina_Share **_share,
|
|||
const char *node_magic_STR)
|
||||
{
|
||||
Eina_Share *share;
|
||||
|
||||
if (_eina_share_common_count++ != 0)
|
||||
return EINA_TRUE;
|
||||
|
||||
share = *_share = calloc(sizeof(Eina_Share), 1);
|
||||
if (!share)
|
||||
return EINA_FALSE;
|
||||
if (!share) goto on_error;
|
||||
|
||||
if (_eina_share_common_log_dom < 0) /*Only register if not already */
|
||||
_eina_share_common_log_dom = eina_log_domain_register(
|
||||
|
@ -611,7 +615,7 @@ eina_share_common_init(Eina_Share **_share,
|
|||
if (_eina_share_common_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Could not register log domain: eina_share_common");
|
||||
return EINA_FALSE;
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
share->share = calloc(1, sizeof(Eina_Share_Common));
|
||||
|
@ -623,7 +627,7 @@ eina_share_common_init(Eina_Share **_share,
|
|||
_eina_share_common_log_dom = -1;
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
share->node_magic = node_magic;
|
||||
|
@ -638,6 +642,10 @@ eina_share_common_init(Eina_Share **_share,
|
|||
|
||||
eina_lock_new(&_mutex_big);
|
||||
return EINA_TRUE;
|
||||
|
||||
on_error:
|
||||
_eina_share_common_count--;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -657,6 +665,9 @@ eina_share_common_shutdown(Eina_Share **_share)
|
|||
unsigned int i;
|
||||
Eina_Share *share = *_share;
|
||||
|
||||
if (--_eina_share_common_count != 0)
|
||||
return EINA_TRUE;
|
||||
|
||||
eina_lock_take(&_mutex_big);
|
||||
|
||||
_eina_share_common_population_stats(share);
|
||||
|
|
Loading…
Reference in New Issue