libreport/0002-free-the-string-not-the-strbuf.patch

58 lines
2.4 KiB
Diff
Raw Normal View History

2011-10-03 08:22:02 +00:00
From 123741b4e05a23fda1767b5f78a5f1022877d6c7 Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Fri, 30 Sep 2011 09:31:27 +0200
Subject: [PATCH 2/4] free the string not the strbuf
---
src/gui-wizard-gtk/wizard.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 3b06425..0279f83 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -691,8 +691,9 @@ static void analyze_rb_was_toggled(GtkButton *button, gpointer user_data)
static void report_tb_was_toggled(GtkButton *button, gpointer user_data)
{
char *event_name = (char *)user_data;
- struct strbuf *reporters_string = strbuf_new();
- struct strbuf *reporters_event_string = strbuf_new();
+ struct strbuf *reporters_strbuf = strbuf_new();
+ struct strbuf *reporters_event_strbuf = strbuf_new();
+ char * reporters_string;
/* if ((button && user_data)
* prevents sigsegv which would happen when call from
@@ -735,21 +736,22 @@ static void report_tb_was_toggled(GtkButton *button, gpointer user_data)
while (li != NULL)
{
event_config_t *cfg = get_event_config(li->data);
- strbuf_append_strf(reporters_event_string,
+ strbuf_append_strf(reporters_event_strbuf,
"%s%s",
- (reporters_event_string->len != 0 ? ", " : ""),
+ (reporters_event_strbuf->len != 0 ? ", " : ""),
(li->data ? li->data : "")
);
- strbuf_append_strf(reporters_string,
+ strbuf_append_strf(reporters_strbuf,
"%s%s",
- (reporters_string->len != 0 ? ", " : ""),
+ (reporters_strbuf->len != 0 ? ", " : ""),
(cfg->screen_name ? cfg->screen_name : li->data)
);
li = g_list_next(li);
}
- g_reporter_events_selected = strbuf_free_nobuf(reporters_event_string);
- gtk_label_set_text(g_lbl_reporters, strbuf_free_nobuf(reporters_string));
+ g_reporter_events_selected = strbuf_free_nobuf(reporters_event_strbuf);
+ reporters_string = strbuf_free_nobuf(reporters_strbuf);
+ gtk_label_set_text(g_lbl_reporters, reporters_string);
free(reporters_string); //we can, gtk copies the string
}
--
1.7.6.4