Author: cazfi
Date: Sat Oct 24 21:43:26 2015
New Revision: 30192

URL: http://svn.gna.org/viewcvs/freeciv?rev=30192&view=rev
Log:
Make sure that message_buffer of gtk-clients exist before appending to it

See patch #6458

Modified:
    trunk/client/gui-gtk-2.0/chatline.c
    trunk/client/gui-gtk-2.0/gui_main.c
    trunk/client/gui-gtk-3.0/chatline.c
    trunk/client/gui-gtk-3.0/gui_main.c

Modified: trunk/client/gui-gtk-2.0/chatline.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/chatline.c?rev=30192&r1=30191&r2=30192&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/chatline.c (original)
+++ trunk/client/gui-gtk-2.0/chatline.c Sat Oct 24 21:43:26 2015
@@ -903,6 +903,13 @@
   ft_offset_t text_start_offset;
 
   buf = message_buffer;
+
+  if (buf == NULL) {
+    log_error("Output when no message buffer: %s", astring);
+
+    return;
+  }
+
   gtk_text_buffer_get_end_iter(buf, &iter);
   gtk_text_buffer_insert(buf, &iter, "\n", -1);
   mark = gtk_text_buffer_create_mark(buf, NULL, &iter, TRUE);

Modified: trunk/client/gui-gtk-2.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/gui_main.c?rev=30192&r1=30191&r2=30192&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/gui_main.c (original)
+++ trunk/client/gui-gtk-2.0/gui_main.c Sat Oct 24 21:43:26 2015
@@ -184,7 +184,7 @@
 static int unit_ids[MAX_NUM_UNITS_BELOW];  /* ids of the units icons in 
                                             * information display: (or 0) */
 GtkTextView *main_message_area;
-GtkTextBuffer *message_buffer;
+GtkTextBuffer *message_buffer = NULL;
 static GtkWidget *allied_chat_toggle_button;
 
 static enum Display_color_type display_color_type;  /* practically unused */
@@ -1024,7 +1024,6 @@
 
   message_buffer = gtk_text_buffer_new(NULL);
 
-
   notebook = gtk_notebook_new();
 
   /* stop mouse wheel notebook page switching. */

Modified: trunk/client/gui-gtk-3.0/chatline.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/chatline.c?rev=30192&r1=30191&r2=30192&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/chatline.c (original)
+++ trunk/client/gui-gtk-3.0/chatline.c Sat Oct 24 21:43:26 2015
@@ -886,6 +886,13 @@
   ft_offset_t text_start_offset;
 
   buf = message_buffer;
+
+  if (buf == NULL) {
+    log_error("Output when no message buffer: %s", astring);
+
+    return;
+  }
+
   gtk_text_buffer_get_end_iter(buf, &iter);
   gtk_text_buffer_insert(buf, &iter, "\n", -1);
   mark = gtk_text_buffer_create_mark(buf, NULL, &iter, TRUE);

Modified: trunk/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.c?rev=30192&r1=30191&r2=30192&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/gui_main.c (original)
+++ trunk/client/gui-gtk-3.0/gui_main.c Sat Oct 24 21:43:26 2015
@@ -169,7 +169,7 @@
 static int unit_ids[MAX_NUM_UNITS_BELOW];  /* ids of the units icons in 
                                             * information display: (or 0) */
 GtkTextView *main_message_area;
-GtkTextBuffer *message_buffer;
+GtkTextBuffer *message_buffer = NULL;
 static GtkWidget *allied_chat_toggle_button;
 
 static enum Display_color_type display_color_type;  /* practically unused */
@@ -1039,7 +1039,6 @@
 
   message_buffer = gtk_text_buffer_new(NULL);
 
-
   notebook = gtk_notebook_new();
 
   /* stop mouse wheel notebook page switching. */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to