parent
d6385af543
commit
68b40793ab
|
@ -26,3 +26,4 @@
|
|||
2012-08-07 Vincent Torri
|
||||
|
||||
* Do not free Windows stuff when it is not used. Fix seg fault
|
||||
* Add log debugging macros
|
||||
|
|
|
@ -13,5 +13,6 @@ Fixes:
|
|||
- Fix segfault when shutting down the Windows monitor.
|
||||
|
||||
Improvements:
|
||||
- Add log debuggong macros
|
||||
|
||||
Removal:
|
||||
|
|
|
@ -59,7 +59,8 @@ struct _Eio_Alloc_Pool
|
|||
EIO_MUTEX_TYPE lock;
|
||||
};
|
||||
|
||||
static int _eio_count = 0;
|
||||
static int _eio_init_count = 0;
|
||||
int _eio_log_dom_global = -1;
|
||||
|
||||
static Eio_Alloc_Pool progress_pool = { 0, NULL, EIO_MUTEX_INITIALIZER };
|
||||
static Eio_Alloc_Pool direct_info_pool = { 0, NULL, EIO_MUTEX_INITIALIZER };
|
||||
|
@ -211,12 +212,27 @@ eio_associate_free(void *data)
|
|||
EAPI int
|
||||
eio_init(void)
|
||||
{
|
||||
_eio_count++;
|
||||
if (++_eio_init_count != 1)
|
||||
return _eio_init_count;
|
||||
|
||||
if (_eio_count > 1) return _eio_count;
|
||||
if (!eina_init())
|
||||
{
|
||||
fprintf(stderr, "Eio can not initialize Eina\n");
|
||||
return --_eio_init_count;
|
||||
}
|
||||
|
||||
eina_init();
|
||||
ecore_init();
|
||||
_eio_log_dom_global = eina_log_domain_register("eio", EIO_DEFAULT_LOG_COLOR);
|
||||
if (_eio_log_dom_global < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Eio can not create a general log domain.");
|
||||
goto shutdown_eina;
|
||||
}
|
||||
|
||||
if (!ecore_init())
|
||||
{
|
||||
ERR("Can not initialize Eina\n");
|
||||
goto unregister_log_domain;
|
||||
}
|
||||
|
||||
EIO_MUTEX_INIT(progress_pool);
|
||||
EIO_MUTEX_INIT(direct_info_pool);
|
||||
|
@ -225,7 +241,14 @@ eio_init(void)
|
|||
|
||||
eio_monitor_init();
|
||||
|
||||
return _eio_count;
|
||||
return _eio_init_count;
|
||||
|
||||
unregister_log_domain:
|
||||
eina_log_domain_unregister(_eio_log_dom_global);
|
||||
_eio_log_dom_global = -1;
|
||||
shutdown_eina:
|
||||
eina_shutdown();
|
||||
return --_eio_init_count;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
|
@ -236,14 +259,13 @@ eio_shutdown(void)
|
|||
Eio_Progress *pg;
|
||||
Eio_File_Associate *asso;
|
||||
|
||||
if (_eio_count <= 0)
|
||||
if (_eio_init_count <= 0)
|
||||
{
|
||||
EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
|
||||
ERR("Init count not greater than 0 in shutdown.");
|
||||
return 0;
|
||||
}
|
||||
_eio_count--;
|
||||
|
||||
if (_eio_count > 0) return _eio_count;
|
||||
if (--_eio_init_count != 0)
|
||||
return _eio_init_count;
|
||||
|
||||
eio_monitor_shutdown();
|
||||
|
||||
|
@ -270,6 +292,9 @@ eio_shutdown(void)
|
|||
associate_pool.count = 0;
|
||||
|
||||
ecore_shutdown();
|
||||
eina_log_domain_unregister(_eio_log_dom_global);
|
||||
_eio_log_dom_global = -1;
|
||||
eina_shutdown();
|
||||
return _eio_count;
|
||||
|
||||
return _eio_init_count;
|
||||
}
|
||||
|
|
|
@ -210,8 +210,15 @@ _eio_monitor_win32_watcher_new(Eio_Monitor *monitor, unsigned char is_dir)
|
|||
&w->overlapped,
|
||||
NULL))
|
||||
{
|
||||
printf("error : %s\n", evil_last_error_get());
|
||||
goto close_event;
|
||||
char *msg;
|
||||
|
||||
msg = evil_last_error_get();
|
||||
if (msg)
|
||||
{
|
||||
ERR("%s\n", msg);
|
||||
free(msg);
|
||||
}
|
||||
goto close_event;
|
||||
}
|
||||
|
||||
w->h = ecore_main_win32_handler_add(w->event,
|
||||
|
@ -280,6 +287,7 @@ void eio_monitor_backend_add(Eio_Monitor *monitor)
|
|||
backend->file = _eio_monitor_win32_watcher_new(monitor, 0);
|
||||
if (!backend->file)
|
||||
{
|
||||
INF("falling back to poll monitoring");
|
||||
free(backend);
|
||||
eio_monitor_fallback_add(monitor);
|
||||
return;
|
||||
|
@ -288,6 +296,7 @@ void eio_monitor_backend_add(Eio_Monitor *monitor)
|
|||
backend->dir = _eio_monitor_win32_watcher_new(monitor, 1);
|
||||
if (!backend->dir)
|
||||
{
|
||||
INF("falling back to poll monitoring");
|
||||
_eio_monitor_win32_watcher_free(backend->file);
|
||||
free(backend);
|
||||
eio_monitor_fallback_add(monitor);
|
||||
|
|
|
@ -91,6 +91,33 @@ typedef struct stat _eio_stat_t;
|
|||
|
||||
#define EIO_PACKED_TIME 0.003
|
||||
|
||||
extern int _eio_log_dom_global;
|
||||
|
||||
#ifdef EIO_DEFAULT_LOG_COLOR
|
||||
# undef EIO_DEFAULT_LOG_COLOR
|
||||
#endif /* ifdef EIO_DEFAULT_LOG_COLOR */
|
||||
#define EIO_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
|
||||
#ifdef ERR
|
||||
# undef ERR
|
||||
#endif /* ifdef ERR */
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_eio_log_dom_global, __VA_ARGS__)
|
||||
#ifdef DBG
|
||||
# undef DBG
|
||||
#endif /* ifdef DBG */
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_eio_log_dom_global, __VA_ARGS__)
|
||||
#ifdef INF
|
||||
# undef INF
|
||||
#endif /* ifdef INF */
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_eio_log_dom_global, __VA_ARGS__)
|
||||
#ifdef WRN
|
||||
# undef WRN
|
||||
#endif /* ifdef WRN */
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_eio_log_dom_global, __VA_ARGS__)
|
||||
#ifdef CRIT
|
||||
# undef CRIT
|
||||
#endif /* ifdef CRIT */
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_eio_log_dom_global, __VA_ARGS__)
|
||||
|
||||
typedef struct _Eio_Eet_Open Eio_Eet_Open;
|
||||
typedef struct _Eio_Eet_Simple Eio_Eet_Simple;
|
||||
typedef struct _Eio_Eet_Write Eio_Eet_Write;
|
||||
|
|
Loading…
Reference in New Issue