Author: cazfi
Date: Sat Oct 24 21:43:41 2015
New Revision: 30194

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

See patch #6458

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

Modified: branches/S2_5/client/gui-gtk-2.0/chatline.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-2.0/chatline.c?rev=30194&r1=30193&r2=30194&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-2.0/chatline.c (original)
+++ branches/S2_5/client/gui-gtk-2.0/chatline.c Sat Oct 24 21:43:41 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: branches/S2_5/client/gui-gtk-2.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-2.0/gui_main.c?rev=30194&r1=30193&r2=30194&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-2.0/gui_main.c (original)
+++ branches/S2_5/client/gui-gtk-2.0/gui_main.c Sat Oct 24 21:43:41 2015
@@ -189,7 +189,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 */
@@ -1029,7 +1029,6 @@
 
   message_buffer = gtk_text_buffer_new(NULL);
 
-
   notebook = gtk_notebook_new();
 
   /* stop mouse wheel notebook page switching. */

Modified: branches/S2_5/client/gui-gtk-3.0/chatline.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/chatline.c?rev=30194&r1=30193&r2=30194&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-3.0/chatline.c (original)
+++ branches/S2_5/client/gui-gtk-3.0/chatline.c Sat Oct 24 21:43:41 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: branches/S2_5/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/gui_main.c?rev=30194&r1=30193&r2=30194&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-3.0/gui_main.c (original)
+++ branches/S2_5/client/gui-gtk-3.0/gui_main.c Sat Oct 24 21:43:41 2015
@@ -174,7 +174,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 */
@@ -1032,7 +1032,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