* Do not free Windows stuff when it is not used. Fix seg fault
* Add log debugging macros
+
+2012-08-30 Cedric Bail
+
+ * Fix memory leak when using file associate API.
- memory leak when shutting down fallback monitor.
- properly shutdown monitor.
- Fix segfault when shutting down the Windows monitor.
+ - Fix memory leak when using file_associate.
Improvements:
- Add log debuggong macros
{
eina_stringshare_del(copy->progress.source);
eina_stringshare_del(copy->progress.dest);
- free(copy);
+ eio_file_free(©->progress.common);
}
static void
async->common.done_cb((void*) async->common.data, &async->common);
- eina_stringshare_del(async->directory);
- free(async);
+ eio_async_free(async);
}
static void
eio_file_error(&async->common);
- eina_stringshare_del(async->directory);
- free(async);
+ eio_async_free(async);
}
/**
{
eina_stringshare_del(copy->source);
eina_stringshare_del(copy->dest);
- free(copy);
+ eio_file_free(©->common);
}
static void
{
eina_stringshare_del(move->progress.source);
eina_stringshare_del(move->progress.dest);
- free(move);
+ eio_file_free(&move->progress.common);
}
static void
}
void
+eio_async_free(Eio_File_Ls *async)
+{
+ eina_stringshare_del(async->directory);
+ eio_file_free(&async->common);
+}
+
+void
eio_async_end(void *data, Ecore_Thread *thread __UNUSED__)
{
Eio_File_Ls *async = data;
async->common.done_cb((void*) async->common.data, &async->common);
- eina_stringshare_del(async->directory);
- free(async);
+ eio_async_free(async);
}
void
eio_file_error(&async->common);
- eina_stringshare_del(async->directory);
- free(async);
+ eio_async_free(async);
}
/**
Ecore_Thread_Cb end_cb,
Ecore_Thread_Cb cancel_cb);
+void eio_file_free(Eio_File *common);
+void eio_async_free(Eio_File_Ls *async);
+
void eio_file_container_set(Eio_File *common, void *container);
void eio_file_error(Eio_File *common);
_eio_mkdir_free(Eio_File_Mkdir *m)
{
eina_stringshare_del(m->path);
- free(m);
+ eio_file_free(&m->common);
}
static void
_eio_unlink_free(Eio_File_Unlink *l)
{
eina_stringshare_del(l->path);
- free(l);
+ eio_file_free(&l->common);
}
static void
_eio_stat_free(Eio_File_Stat *s)
{
eina_stringshare_del(s->path);
- free(s);
+ eio_file_free(&s->common);
}
static void
if (ch->user) eina_stringshare_del(ch->user);
if (ch->group) eina_stringshare_del(ch->group);
eina_stringshare_del(ch->path);
- free(ch);
+ eio_file_free(&ch->common);
}
static void
ecore_thread_cancel(thread);
}
+void
+eio_file_free(Eio_File *common)
+{
+ if (common->worker.associated)
+ eina_hash_free(common->worker.associated);
+ if (common->main.associated)
+ eina_hash_free(common->main.associated);
+ free(common);
+}
+
Eina_Bool
eio_long_file_set(Eio_File *common,
Eio_Done_Cb done_cb,
common->error = 0;
common->thread = NULL;
common->container = NULL;
+ common->worker.associated = NULL;
+ common->main.associated = NULL;
/* Be aware that ecore_thread_run could call cancel_cb if something goes wrong.
This means that common would be destroyed if thread == NULL.
if (async->op == EIO_XATTR_DATA) free(async->todo.xdata.xattr_data);
if (async->op == EIO_XATTR_STRING) free(async->todo.xstring.xattr_string);
}
- free(async);
+ eio_file_free(&async->common);
}
static void