From a1f4984a4e28a0d5cb3a8392dd4e80f92d6f8bbd Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sat, 13 Nov 2010 16:36:43 +0100 Subject: [PATCH] Make conky not crash on exit when using weather objects --- src/conky.cc | 8 +++++--- src/timed-thread.cc | 5 +---- src/timed-thread.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/conky.cc b/src/conky.cc index 8c58b7f7..3b81a16f 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -2522,6 +2522,11 @@ void clean_up_without_threads(void *memtofree1, void* memtofree2) { currentconffile = NULL; free_and_zero(memtofree1); free_and_zero(memtofree2); + +#if defined BUILD_WEATHER_METAR || defined BUILD_WEATHER_XOAP + weather_free_info(); +#endif + timed_thread::destroy_registered_threads(); free_and_zero(info.cpu_usage); @@ -2564,9 +2569,6 @@ void clean_up_without_threads(void *memtofree1, void* memtofree2) { #ifdef BUILD_RSS rss_free_info(); #endif -#if defined BUILD_WEATHER_METAR || defined BUILD_WEATHER_XOAP - weather_free_info(); -#endif #ifdef BUILD_LUA llua_shutdown_hook(); llua_close(); diff --git a/src/timed-thread.cc b/src/timed-thread.cc index b27da658..76439f13 100644 --- a/src/timed-thread.cc +++ b/src/timed-thread.cc @@ -102,7 +102,7 @@ timed_thread::timed_thread(const std::function &start_rou } /* destroy a timed thread. */ -void timed_thread::destroy(bool deregister_this) +void timed_thread::destroy() { DBGP("destroying thread %ld", (long)p_timed_thread->thread.get()); #ifdef DEBUG @@ -125,9 +125,6 @@ void timed_thread::destroy(bool deregister_this) close(p_timed_thread->pipefd[1]); running = false; - - if (deregister_this) deregister(this); - } /* lock a timed thread for critical section activity */ diff --git a/src/timed-thread.h b/src/timed-thread.h index c2c3059e..8c4d723b 100644 --- a/src/timed-thread.h +++ b/src/timed-thread.h @@ -102,7 +102,7 @@ class timed_thread { int test(int override_wait_time); /* destroy a timed thread */ - void destroy(bool deregister_this = true); + void destroy(); /* register a timed thread for destruction */ static int register_(const timed_thread_ptr &timed_thread);