comparison src/gtkdebug.c @ 7152:cada5ddc21f5

[gaim-migrate @ 7719] Thanks to Sean for committing my patch and attempting to fix it. It gave me the motivation to figure out what was wrong, which turned out to be a g_free() in the wrong place in the GAIM_DEBUG_FATAL handling code. Now it works how it was supposed to. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 05 Oct 2003 00:46:28 +0000
parents e09020153d85
children 26fe5055e0b0
comparison
equal deleted inserted replaced
7151:a583416b6d6d 7152:cada5ddc21f5
3 * @ingroup gtkui 3 * @ingroup gtkui
4 * 4 *
5 * gaim 5 * gaim
6 * 6 *
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> 7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 13 *
221 { 221 {
222 GaimDebugLevel level; 222 GaimDebugLevel level;
223 char *new_msg = NULL; 223 char *new_msg = NULL;
224 char *new_domain = NULL; 224 char *new_domain = NULL;
225 225
226 if ((flags & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_ERROR) 226 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR)
227 level = GAIM_DEBUG_ERROR; 227 level = GAIM_DEBUG_ERROR;
228 else if ((flags & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_CRITICAL) 228 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL)
229 level = GAIM_DEBUG_FATAL; 229 level = GAIM_DEBUG_FATAL;
230 else if ((flags & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_WARNING) 230 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING)
231 level = GAIM_DEBUG_WARNING; 231 level = GAIM_DEBUG_WARNING;
232 else if ((flags & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_MESSAGE) 232 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE)
233 level = GAIM_DEBUG_INFO; 233 level = GAIM_DEBUG_INFO;
234 else if ((flags & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_INFO) 234 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO)
235 level = GAIM_DEBUG_INFO; 235 level = GAIM_DEBUG_INFO;
236 else if ((flags & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG) 236 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG)
237 level = GAIM_DEBUG_MISC; 237 level = GAIM_DEBUG_MISC;
238 else { 238 else
239 gaim_debug(GAIM_DEBUG_WARNING, "gtkdebug", 239 {
240 gaim_debug_warning("gtkdebug",
240 "Unknown glib logging level in %d\n", flags); 241 "Unknown glib logging level in %d\n", flags);
241 242
242 level = GAIM_DEBUG_MISC; /* This will never happen. */ 243 level = GAIM_DEBUG_MISC; /* This will never happen. */
243 } 244 }
244 245
246 new_msg = gaim_utf8_try_convert(msg); 247 new_msg = gaim_utf8_try_convert(msg);
247 248
248 if (domain != NULL) 249 if (domain != NULL)
249 new_domain = gaim_utf8_try_convert(domain); 250 new_domain = gaim_utf8_try_convert(domain);
250 251
251 if (new_msg != NULL) { 252 if (new_msg != NULL)
252 gaim_debug(GAIM_DEBUG_MISC, new_domain ? new_domain : "g_log", 253 {
253 "%s\n", new_msg); 254 gaim_debug(level, (new_domain != NULL ? new_domain : "g_log"),
255 "%s\n", new_msg);
254 256
255 g_free(new_msg); 257 g_free(new_msg);
256 } 258 }
257 259
258 if (new_domain != NULL) 260 if (new_domain != NULL)
380 s = utf8_s; 382 s = utf8_s;
381 383
382 if (level == GAIM_DEBUG_FATAL) { 384 if (level == GAIM_DEBUG_FATAL) {
383 gchar *temp = s; 385 gchar *temp = s;
384 386
385 g_free(s);
386 s = g_strdup_printf("<b>%s</b>", temp); 387 s = g_strdup_printf("<b>%s</b>", temp);
387 g_free(temp); 388 g_free(temp);
388 } 389 }
389 390
390 g_free(cat_s); 391 g_free(cat_s);