ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [ethereal-dev] GTK segfault

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Fri, 10 Dec 1999 01:15:47 -0600
Sigh... I just had a segfault when moving from packet
to packet, highlighting protocol items. Normal usage.
The segfault occured from within gtk:

#0  0x4014a2ec in undraw_cursor (text=0x8183490, absolute=0) at gtktext.c:5170
#1  0x40144f24 in gtk_text_adjustment (adjustment=0x8183ce8, text=0x8183490) at gtktext.c:2306
#2  0x400fc071 in gtk_marshal_NONE__NONE (object=0x8183ce8, func=0x40144d10 <gtk_text_adjustment>, 
    func_data=0x8183490, args=0xbfffe81c) at gtkmarshal.c:312
#3  0x4012f0fc in gtk_handlers_run (handlers=0x81b0c60, signal=0xbfffe7c8, object=0x8183ce8, 
    params=0xbfffe81c, after=0) at gtksignal.c:1909
#4  0x4012e555 in gtk_signal_real_emit (object=0x8183ce8, signal_id=95, params=0xbfffe81c) at gtksignal.c:1469
#5  0x4012c956 in gtk_signal_emit_by_name (object=0x8183ce8, name=0x4018696b "value_changed")
    at gtksignal.c:618
#6  0x40148da8 in scroll_int (text=0x8183490, diff=-13) at gtktext.c:4473
#7  0x40146dd6 in find_line_containing_point (text=0x8183490, point=0, scroll=1) at gtktext.c:3601
#8  0x401473ca in find_cursor (text=0x8183490, scroll=1) at gtktext.c:3781
#9  0x4014abbb in recompute_geometry (text=0x8183490) at gtktext.c:5442
#10 0x40141b39 in gtk_text_thaw (text=0x8183490) at gtktext.c:917
#11 0x80ddd39 in packet_hex_print (bv=0x8183490, pd=0x81566bc "\020@�", len=49, bstart=-1, blen=-1, 
    encoding=CHAR_ASCII) at proto_draw.c:141
#12 0x80d863d in tree_view_cb (w=0x81b94f8, data=0x0) at main.c:780


I'm using gtk+-1.2.6. The code in question is:

5165        {
5166          GdkFont* font;
5167          
5168          g_assert(text->cursor_mark.property);
5169    
5170          font = MARK_CURRENT_FONT(text, &text->cursor_mark);
5171    
5172          draw_bg_rect (text, &text->cursor_mark, 
5173                        text->cursor_pos_x,
5174                        text->cursor_pos_y - text->cursor_char_offset - font->ascent,


The macro MARK_CURRENT_FONT uses the MARK_CURRENT_PROPERTY macro to
provide a pointer. We have:

#define MARK_CURRENT_PROPERTY(mark) ((TextProperty*)(mark)->property->data)

#define MARK_CURRENT_FONT(text, mark) \
  ((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_FONT) ? \
         MARK_CURRENT_PROPERTY(mark)->font->gdk_font : \
         GTK_WIDGET (text)->style->font)

and guess what?

(gdb) print text->cursor_mark->property->data
$1 = 0x0

I'll spend a wee bit of time to see if I can't see why data is 0.

So far, I have been unable to reproduce the crash.

--gilbert