aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/main_proto_draw.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2010-02-04 14:41:22 +0000
committerBill Meier <wmeier@newsguy.com>2010-02-04 14:41:22 +0000
commit16b04d41e0c61d146ad63e60c0cf4b2c14030f97 (patch)
treeeb1fd96879bb411534dc46ea1cf039d3187917d4 /gtk/main_proto_draw.c
parent0925d015d962621ba755f378907e8f40b03e1fc1 (diff)
Fix a crash which occurs if a progress bar is displayed while generating a hex bytes pane.
svn path=/trunk/; revision=31786
Diffstat (limited to 'gtk/main_proto_draw.c')
-rw-r--r--gtk/main_proto_draw.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/gtk/main_proto_draw.c b/gtk/main_proto_draw.c
index 1c403f898b..b6a8c33226 100644
--- a/gtk/main_proto_draw.c
+++ b/gtk/main_proto_draw.c
@@ -1120,7 +1120,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
unsigned int use_digits;
gboolean reverse, newreverse;
GtkTextView *bv_text_view = GTK_TEXT_VIEW(bv);
- GtkTextBuffer *buf = gtk_text_view_get_buffer(bv_text_view);
+ GtkTextBuffer *buf;
GtkTextIter iter;
const char *revstyle;
GtkTextMark *mark = NULL;
@@ -1133,10 +1133,28 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
int progbar_nextstep;
int progbar_quantum;
+ buf = gtk_text_view_get_buffer(bv_text_view);
+ g_object_ref(buf);
+#if 0
+ gtk_text_view_set_buffer( bv_text_view, NULL); /* XXX: Apparently not a good idea; If a progress_bar
+ * is displayed below in delayed_create_progress_dlg()
+ * there will then be a crash internally in the gtk library.
+ * (It appears that gtk_tree_view_set_buffer
+ * queues a callback to be run when this
+ * thread is next idle. Unfortunately the call to
+ * gtk_main_iteration() in delayed_create_progress_dlg()
+ * causes the internal callback to be run which then
+ * crashes (because the textview has no buffer ?))
+ */
+#endif
+ gtk_text_view_set_buffer( bv_text_view,
+ gtk_text_buffer_new(NULL));/* attach a dummy buffer in place of the real buffer.
+ * (XXX: Presumably this is done so there's no attempt
+ * to display the real buffer until it has been
+ * completely generated).
+ */
gtk_text_buffer_set_text(buf, "", 0);
gtk_text_buffer_get_start_iter(buf, &iter);
- g_object_ref(buf);
- gtk_text_view_set_buffer( bv_text_view, NULL);
/*
* How many of the leading digits of the offset will we supply?