Revision: 16890
Author: thekingant
Date: 2006-08-19 13:31:34 -0700 (Sat, 19 Aug 2006)
ViewCVS: http://svn.sourceforge.net/gaim/?rev=16890&view=rev
Log Message:
-----------
Backport SVN revision 16445 from HEAD to v2_0_0beta3_1
Original commit message:
Fix a crash bug on some systems (mostly amd64) caused by using a va_list
twice. My bad! Thanks to Kevin Stange and Vincent Ho for noticing this
and suggesting the cause. Vincent's IRC handle reminds me of a Harvey
Danger song.
ViewCVS Links:
-------------
http://svn.sourceforge.net/gaim/?rev=16445&view=rev
Modified Paths:
--------------
branches/v2_0_0beta3_1/gaim/src/debug.c
branches/v2_0_0beta3_1/gaim/src/debug.h
branches/v2_0_0beta3_1/gaim/src/gtkdebug.c
Modified: branches/v2_0_0beta3_1/gaim/src/debug.c
===================================================================
--- branches/v2_0_0beta3_1/gaim/src/debug.c 2006-08-19 20:02:26 UTC (rev 16889)
+++ branches/v2_0_0beta3_1/gaim/src/debug.c 2006-08-19 20:31:34 UTC (rev 16890)
@@ -46,15 +46,21 @@
const char *format, va_list args)
{
GaimDebugUiOps *ops;
+ char *arg_s = NULL;
g_return_if_fail(level != GAIM_DEBUG_ALL);
g_return_if_fail(format != NULL);
+ ops = gaim_debug_get_ui_ops();
+
+ if (!debug_enabled && ((ops == NULL) || (ops->print == NULL)))
+ return;
+
+ arg_s = g_strdup_vprintf(format, args);
+
if (debug_enabled) {
- gchar *arg_s, *ts_s;
+ gchar *ts_s;
- arg_s = g_strdup_vprintf(format, args);
-
if ((category != NULL) &&
(gaim_prefs_exists("/core/debug/timestamps")) &&
(gaim_prefs_get_bool("/core/debug/timestamps"))) {
@@ -72,14 +78,13 @@
else
g_print("%s%s: %s", ts_s, category, arg_s);
- g_free(arg_s);
g_free(ts_s);
}
- ops = gaim_debug_get_ui_ops();
+ if (ops != NULL && ops->print != NULL)
+ ops->print(level, category, arg_s);
- if (ops != NULL && ops->print != NULL)
- ops->print(level, category, format, args);
+ g_free(arg_s);
}
void
Modified: branches/v2_0_0beta3_1/gaim/src/debug.h
===================================================================
--- branches/v2_0_0beta3_1/gaim/src/debug.h 2006-08-19 20:02:26 UTC (rev 16889)
+++ branches/v2_0_0beta3_1/gaim/src/debug.h 2006-08-19 20:31:34 UTC (rev 16890)
@@ -48,7 +48,7 @@
typedef struct
{
void (*print)(GaimDebugLevel level, const char *category,
- const char *format, va_list args);
+ const char *arg_s);
} GaimDebugUiOps;
#ifdef __cplusplus
Modified: branches/v2_0_0beta3_1/gaim/src/gtkdebug.c
===================================================================
--- branches/v2_0_0beta3_1/gaim/src/gtkdebug.c 2006-08-19 20:02:26 UTC (rev 16889)
+++ branches/v2_0_0beta3_1/gaim/src/gtkdebug.c 2006-08-19 20:31:34 UTC (rev 16890)
@@ -931,13 +931,13 @@
static void
gaim_gtk_debug_print(GaimDebugLevel level, const char *category,
- const char *format, va_list args)
+ const char *arg_s)
{
#ifdef HAVE_REGEX_H
GtkTreeIter iter;
#endif /* HAVE_REGEX_H */
gboolean timestamps;
- gchar *arg_s, *ts_s;
+ gchar *ts_s;
gchar *esc_s, *cat_s, *tmp, *s;
if (!gaim_prefs_get_bool("/gaim/gtk/debug/enabled") ||
@@ -948,8 +948,6 @@
timestamps = gaim_prefs_get_bool("/core/debug/timestamps");
- arg_s = g_strdup_vprintf(format, args);
-
/*
* For some reason we only print the timestamp if category is
* not NULL. Why the hell do we do that? --Mark
@@ -971,8 +969,6 @@
esc_s = g_markup_escape_text(arg_s, -1);
- g_free(arg_s);
-
s = g_strdup_printf("<font color=\"%s\">%s%s%s</font>",
debug_fg_colors[level], ts_s, cat_s, esc_s);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|