pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/ui/gui message-dialog.c ChangeLog


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src/ui/gui message-dialog.c ChangeLog
Date: Wed, 20 Feb 2008 04:24:30 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 08/02/20 04:24:30

Modified files:
        src/ui/gui     : message-dialog.c ChangeLog 

Log message:
        (popup_messages): Always destroy `msg' and `lead' strings, avoiding a
        memory leak.  Thanks to John Darrington for reporting the problem.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/message-dialog.c?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.112&r2=1.113

Patches:
Index: message-dialog.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/gui/message-dialog.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- message-dialog.c    10 Feb 2008 07:08:45 -0000      1.29
+++ message-dialog.c    20 Feb 2008 04:24:29 -0000      1.30
@@ -189,7 +189,8 @@
   GtkTextIter end;
   GtkTextView *text_view;
   GtkLabel *label;
-  struct string lead, msg;
+  struct string lead = DS_EMPTY_INITIALIZER;
+  struct string msg = DS_EMPTY_INITIALIZER;
   int message_cnt;
 
   /* If a pointer grab is in effect, then the combination of that, and
@@ -201,7 +202,6 @@
 
   /* Compose the lead-in. */
   message_cnt = error_cnt + warning_cnt + note_cnt;
-  ds_init_empty (&lead);
   if (dropped_messages == 0)
     ds_put_format (
       &lead,
@@ -227,7 +227,6 @@
 
 
   /* Compose the messages. */
-  ds_init_empty (&msg);
   while (!g_queue_is_empty (early_queue))
     format_message (g_queue_pop_head (early_queue), &msg);
   if (dropped_messages)
@@ -246,7 +245,6 @@
   text_buffer = gtk_text_buffer_new (NULL);
   gtk_text_buffer_get_end_iter (text_buffer, &end);
   gtk_text_buffer_insert (text_buffer, &end, ds_data (&msg), ds_length (&msg));
-  ds_destroy (&msg);
 
   label = GTK_LABEL (get_widget_assert (message_xml, "lead-in"));
   if (label == NULL)
@@ -261,6 +259,9 @@
   gtk_dialog_run (message_dialog);
   gtk_widget_hide (GTK_WIDGET (message_dialog));
 
+  ds_destroy (&lead);
+  ds_destroy (&msg);
+
   return FALSE;
 
 use_fallback:

Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- ChangeLog   19 Feb 2008 00:35:20 -0000      1.112
+++ ChangeLog   20 Feb 2008 04:24:30 -0000      1.113
@@ -1,3 +1,9 @@
+2008-02-19  Ben Pfaff  <address@hidden>
+
+       * message-dialog.c (popup_messages): Always destroy `msg' and
+       `lead' strings, avoiding a memory leak.  Thanks to John Darrington
+       for reporting the problem.
+
 2008-02-19  John Darrington <address@hidden>
 
        * dict-display.c: Display names of variables in dialog box




reply via email to

[Prev in Thread] Current Thread [Next in Thread]