diff options
author | Christian Grothoff <christian@grothoff.org> | 2008-06-27 19:26:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2008-06-27 19:26:33 +0000 |
commit | 4cbd002f3aaa8c068ea4063be309c8c1e15a489b (patch) | |
tree | 8aa84450aef2ce9d1f962d9e3845011d4cc6eed8 | |
parent | 30fd9ccc87d4621a3622b329b3074bab9ed6cedf (diff) | |
download | gnunet-gtk-4cbd002f3aaa8c068ea4063be309c8c1e15a489b.tar.gz gnunet-gtk-4cbd002f3aaa8c068ea4063be309c8c1e15a489b.zip |
handle logs during shutdown
-rw-r--r-- | src/common/helper.c | 2 | ||||
-rw-r--r-- | src/common/logging.c | 12 | ||||
-rw-r--r-- | src/core/main.c | 3 | ||||
-rw-r--r-- | src/include/gnunetgtk_common.h | 3 |
4 files changed, 19 insertions, 1 deletions
diff --git a/src/common/helper.c b/src/common/helper.c index 1090fefa..864051a9 100644 --- a/src/common/helper.c +++ b/src/common/helper.c | |||
@@ -142,6 +142,7 @@ GNUNET_GTK_save_call (GNUNET_ThreadMainFunction func, void *args) | |||
142 | GNUNET_mutex_lock (sclock); | 142 | GNUNET_mutex_lock (sclock); |
143 | if ((saveCallsUp == GNUNET_NO) || (!GNUNET_thread_test_self (mainThread))) | 143 | if ((saveCallsUp == GNUNET_NO) || (!GNUNET_thread_test_self (mainThread))) |
144 | { | 144 | { |
145 | GNUNET_GE_ASSERT(NULL, saveCallsUp != GNUNET_SYSERR); | ||
145 | call.args = args; | 146 | call.args = args; |
146 | call.func = func; | 147 | call.func = func; |
147 | call.sem = GNUNET_semaphore_create (0); | 148 | call.sem = GNUNET_semaphore_create (0); |
@@ -417,6 +418,7 @@ GNUNET_GTK_shutdown_plugins () | |||
417 | i = pscCount; | 418 | i = pscCount; |
418 | GNUNET_mutex_unlock (sclock); | 419 | GNUNET_mutex_unlock (sclock); |
419 | } | 420 | } |
421 | saveCallsUp = GNUNET_SYSERR; | ||
420 | } | 422 | } |
421 | 423 | ||
422 | void | 424 | void |
diff --git a/src/common/logging.c b/src/common/logging.c index 677c4783..e5ddcea8 100644 --- a/src/common/logging.c +++ b/src/common/logging.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | static GtkWidget *infoWindowTextView; | 33 | static GtkWidget *infoWindowTextView; |
34 | 34 | ||
35 | static int is_shutdown; | ||
36 | |||
35 | static void | 37 | static void |
36 | init () | 38 | init () |
37 | { | 39 | { |
@@ -127,6 +129,8 @@ GNUNET_GTK_add_log_entry (const char *txt, ...) | |||
127 | va_list args; | 129 | va_list args; |
128 | gchar *note; | 130 | gchar *note; |
129 | 131 | ||
132 | if (is_shutdown) | ||
133 | return; | ||
130 | va_start (args, txt); | 134 | va_start (args, txt); |
131 | note = g_strdup_vprintf (txt, args); | 135 | note = g_strdup_vprintf (txt, args); |
132 | va_end (args); | 136 | va_end (args); |
@@ -139,9 +143,17 @@ static void | |||
139 | ge_gtk_log_handler (void *ctx, | 143 | ge_gtk_log_handler (void *ctx, |
140 | GNUNET_GE_KIND kind, const char *date, const char *msg) | 144 | GNUNET_GE_KIND kind, const char *date, const char *msg) |
141 | { | 145 | { |
146 | if (is_shutdown) | ||
147 | return; | ||
142 | GNUNET_GTK_show_info_message ("%s: %s", date, msg); | 148 | GNUNET_GTK_show_info_message ("%s: %s", date, msg); |
143 | } | 149 | } |
144 | 150 | ||
151 | void | ||
152 | GNUNET_GTK_shutdown_logger() | ||
153 | { | ||
154 | is_shutdown = GNUNET_YES; | ||
155 | } | ||
156 | |||
145 | struct GNUNET_GE_Context * | 157 | struct GNUNET_GE_Context * |
146 | GNUNET_GTK_create_gtk_logger (GNUNET_GE_KIND mask) | 158 | GNUNET_GTK_create_gtk_logger (GNUNET_GE_KIND mask) |
147 | { | 159 | { |
diff --git a/src/core/main.c b/src/core/main.c index 52dc2a12..cd8062de 100644 --- a/src/core/main.c +++ b/src/core/main.c | |||
@@ -159,8 +159,9 @@ main (int argc, char *const *argv) | |||
159 | gtk_main (); | 159 | gtk_main (); |
160 | gdk_threads_leave (); | 160 | gdk_threads_leave (); |
161 | GNUNET_GE_setDefaultContext (ectx); | 161 | GNUNET_GE_setDefaultContext (ectx); |
162 | GNUNET_GTK_shutdown_logger(); | ||
163 | GNUNET_GTK_shutdown_common_library (); | ||
162 | GNUNET_GE_free_context (my_ctx); | 164 | GNUNET_GE_free_context (my_ctx); |
163 | GNUNET_GTK_shutdown_common_library (); | ||
164 | GNUNET_fini (ectx, cfg); | 165 | GNUNET_fini (ectx, cfg); |
165 | return 0; | 166 | return 0; |
166 | } | 167 | } |
diff --git a/src/include/gnunetgtk_common.h b/src/include/gnunetgtk_common.h index ff8e9034..678a5a71 100644 --- a/src/include/gnunetgtk_common.h +++ b/src/include/gnunetgtk_common.h | |||
@@ -91,6 +91,9 @@ void GNUNET_GTK_add_log_entry (const char *txt, ...); | |||
91 | 91 | ||
92 | struct GNUNET_GE_Context *GNUNET_GTK_create_gtk_logger (GNUNET_GE_KIND mask); | 92 | struct GNUNET_GE_Context *GNUNET_GTK_create_gtk_logger (GNUNET_GE_KIND mask); |
93 | 93 | ||
94 | void | ||
95 | GNUNET_GTK_shutdown_logger(); | ||
96 | |||
94 | #define GNUNET_GTK_NOTIFY_LEVEL_LOW 0 | 97 | #define GNUNET_GTK_NOTIFY_LEVEL_LOW 0 |
95 | #define GNUNET_GTK_NOTIFY_LEVEL_NORMAL 1 | 98 | #define GNUNET_GTK_NOTIFY_LEVEL_NORMAL 1 |
96 | #define GNUNET_GTK_NOTIFY_LEVEL_CRITICAL 2 | 99 | #define GNUNET_GTK_NOTIFY_LEVEL_CRITICAL 2 |