From 6938cbfd0c8d64aa93633fc7423879de757fd45c Mon Sep 17 00:00:00 2001 From: Burt P Date: Thu, 25 Jul 2019 20:43:25 -0500 Subject: replace idle_free() with auto_free() from sysobj * auto_free() works in both report mode and gui mode. * auto_free() only creates one recuring event for the whole system rather than idle_free()'s one event per call. * auto_free_ex() allows specifying the free function to use. * auto_free() is thread-aware, free_auto_free_thread_final() can be used to clean up on thread exit. * auto_free() has some tweakability. Signed-off-by: Burt P --- hardinfo/hardinfo.c | 1 + hardinfo/util.c | 22 ---------------------- 2 files changed, 1 insertion(+), 22 deletions(-) (limited to 'hardinfo') diff --git a/hardinfo/hardinfo.c b/hardinfo/hardinfo.c index 6e812fb1..76527364 100644 --- a/hardinfo/hardinfo.c +++ b/hardinfo/hardinfo.c @@ -162,6 +162,7 @@ int main(int argc, char **argv) moreinfo_shutdown(); vendor_cleanup(); dmidecode_cache_free(); + free_auto_free_final(); DEBUG("finished"); return exit_code; diff --git a/hardinfo/util.c b/hardinfo/util.c index c8c99224..b35b2461 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -1031,28 +1031,6 @@ gint tree_view_get_visible_height(GtkTreeView * tv) return nrows * rect.height; } -static gboolean __idle_free_do(gpointer ptr) -{ - g_free(ptr); - - return FALSE; -} - -#if RELEASE == 1 -gpointer idle_free(gpointer ptr) -#else -gpointer __idle_free(gpointer ptr, gchar * f, gint l) -#endif -{ - DEBUG("file: %s, line: %d, ptr %p", f, l, ptr); - - if (ptr) { - g_timeout_add(10000, __idle_free_do, ptr); - } - - return ptr; -} - void module_entry_scan_all_except(ModuleEntry * entries, gint except_entry) { ModuleEntry entry; -- cgit v1.2.3