How should I fix crash during error dialogs with GTK?


Subject: How should I fix crash during error dialogs with GTK?
From: Peter Haight (peterh@sapros.com)
Date: Mon Aug 28 2000 - 23:57:40 CDT


I had the fonts setup wrong so the 'Symbol' font was missing from X. This
means that when I chose 'Insert->Symbol', AbiWord would try and launch a
dialog informing me that the font was missing. This would cause an ASSERT
which would stop my debug build.

The problem is that the dialog box runs 'gtk_main' which will handle any
pending signals (events). In this case, we were in the middle of
constructing the Insert Symbol dialog and it was not fully ready to handle
signals, but its signals get called. This hits some well placed ASSERTS.

I see basically three choices here. One is to make it so that it can handle
these signals even when it isn't fully constructed. The second is to not
register the signals until after the dialog is in a better state. The third
is to somehow get GTK to only execute the events relating to the modal error
dialog instead of executing all the events.

I like the third solution best, but don't know GTK all that well and can't
see how to do it easily.

I have a patch which fixes this problem with the Insert Symbol dialog if
only the Symbol font is missing. In this case, I delay the _connectSignals
call until after the dialog is totally setup.

If the AbiSource Times New Roman font is missing, I have the same problem
during startup. I don't have a good fix for that yet. There is a lot going
on at that point and I haven't figured out the best way. Does anyone have
any suggestions?

Here's a stack trace that illustrates the Insert Symbol case:

1 0x8496f62 in abort () at xap_UnixPSImage.cpp:199
#2 0x845b4ad in g_logv () at xap_UnixPSImage.cpp:199
#3 0x845b540 in g_log () at xap_UnixPSImage.cpp:199
#4 0x80ada77 in GR_UnixGraphics::measureUnRemappedChar (this=0x86af400,
c=32)
    at gr_UnixGraphics.cpp:182
#5 0x80b077f in GR_Graphics::remapGlyph (this=0x86af400, actual=32,
    noMatterWhat=0 '\000') at gr_Graphics.cpp:211
#6 0x80ad705 in GR_UnixGraphics::drawChar (this=0x86af400, Char=32, xoff=2,
    yoff=0) at gr_UnixGraphics.cpp:99
#7 0x813c992 in XAP_Draw_Symbol::draw (this=0x86b2580)
    at xap_Draw_Symbol.cpp:183
#8 0x81dae62 in XAP_UnixDialog_Insert_Symbol::SymbolMap_exposed (
    this=0x8896800) at xap_UnixDlg_Insert_Symbol.cpp:288
#9 0x81da26e in s_sym_SymbolMap_exposed (widget=0x86abf40, e=0x8899074,
    dlg=0x8896800) at xap_UnixDlg_Insert_Symbol.cpp:106
#10 0x830d920 in gtk_marshal_BOOL__POINTER (object=0x86abf40,
    func=0x81da214 <s_sym_SymbolMap_exposed(_GtkWidget *, _GdkEvent *,
XAP_UnixDialog_Insert_Symbol *)>, func_data=0x8896800, args=0xbfbfe33c)
    at gtkmarshal.c:28
#11 0x83497d6 in gtk_handlers_run (handlers=0x86ad4a0, signal=0xbfbfe2f0,
    object=0x86abf40, params=0xbfbfe33c, after=0) at gtksignal.c:1917
#12 0x8348861 in gtk_signal_real_emit (object=0x86abf40, signal_id=25,
    params=0xbfbfe33c) at gtksignal.c:1477
#13 0x8345f76 in gtk_signal_emit (object=0x86abf40, signal_id=25)
    at gtksignal.c:552
#14 0x8385785 in gtk_widget_event (widget=0x86abf40, event=0x8899074)
    at gtkwidget.c:2860
#15 0x830c510 in gtk_main_do_event (event=0x8899074) at gtkmain.c:713
#16 0x83aa913 in gdk_event_dispatch (source_data=0x0,
current_time=0xbfbfe70c,
    user_data=0x0) at gdkevents.c:2129
#17 0x84592f5 in g_main_dispatch () at xap_UnixPSImage.cpp:199
#18 0x84598bd in g_main_iterate () at xap_UnixPSImage.cpp:199
#19 0x8459a04 in g_main_run () at xap_UnixPSImage.cpp:199
#20 0x830be6c in gtk_main () at gtkmain.c:476
#21 0x8085edc in messageBoxOK (
    message=0xbfbfe7ec "AbiWord could not load the following font from the X
Window System display
server:\n[-*-Symbol-regular-r-*-*-*-0-*-*-*-*-*-*]\n\nThis error could be
the result of an incomplete AbiSuite installation,\nan "...)
    at ut_dialogHelper.cpp:299
#22 0x81291d8 in XAP_UnixFont::getGdkFont (this=0x868cf80, pixelsize=19)
    at xap_UnixFont.cpp:993
#23 0x81278d0 in XAP_UnixFontHandle::getGdkFont (this=0x8888ac0)
    at xap_UnixFont.cpp:66
#24 0x80ad942 in GR_UnixGraphics::setFont (this=0x86af400, pFont=0x8888ac0)
    at gr_UnixGraphics.cpp:147
#25 0x813c67b in XAP_Draw_Symbol::setFontToGC (this=0x86b2580,
p_gc=0x86af400,
    MaxWidthAllowable=19, PointSize=14) at xap_Draw_Symbol.cpp:100
#26 0x813c4df in XAP_Draw_Symbol::setFontString (this=0x86b2580)
    at xap_Draw_Symbol.cpp:74
#27 0x813c813 in XAP_Draw_Symbol::setSelectedFont (this=0x86b2580,
    font=0x8515959 "Symbol") at xap_Draw_Symbol.cpp:150
#28 0x81dab3e in XAP_UnixDialog_Insert_Symbol::runModeless (this=0x8896800,
    pFrame=0x86a4000) at xap_UnixDlg_Insert_Symbol.cpp:234
#29 0x805d57d in s_InsertSymbolDlg (pView=0x888c200, id=9)
    at ap_EditMethods.cpp:3878
#30 0x805e81b in ap_EditMethods::insSymbol (pAV_View=0x888c200)
    at ap_EditMethods.cpp:4243
#31 0x817acdc in EV_Menu::invokeMenuMethod (this=0x868e880, pView=0x888c200,
    pEM=0x8624eb0, pData=0x0, dataLength=0) at ev_Menu.cpp:93
#32 0x8178bf5 in EV_UnixGnomeMenu::menuEvent (pAux=0x880bbe0)
    at ev_UnixGnomeMenu.cpp:642
#33 0x830dd89 in gtk_marshal_NONE__NONE (object=0x882b780,
    func=0x8178a6c <EV_UnixGnomeMenu::menuEvent(_GtkWidget *, void *)>,
    func_data=0x880bbe0, args=0xbfbff07c) at gtkmarshal.c:312
#34 0x83497d6 in gtk_handlers_run (handlers=0x8829c80, signal=0xbfbff030,
    object=0x882b780, params=0xbfbff07c, after=0) at gtksignal.c:1917
#35 0x8348861 in gtk_signal_real_emit (object=0x882b780, signal_id=76,
    params=0xbfbff07c) at gtksignal.c:1477
#36 0x8345f76 in gtk_signal_emit (object=0x882b780, signal_id=76)
    at gtksignal.c:552
#37 0x8385995 in gtk_widget_activate (widget=0x882b780) at gtkwidget.c:2886
#38 0x8317f24 in gtk_menu_shell_activate_item (menu_shell=0x8828f00,
    menu_item=0x882b780, force_deactivate=1) at gtkmenushell.c:849
#39 0x8316a64 in gtk_menu_shell_button_release (widget=0x8828f00,
    event=0x8899018) at gtkmenushell.c:485
#40 0x830d920 in gtk_marshal_BOOL__POINTER (object=0x8828f00,
    func=0x83167d8 <gtk_menu_shell_button_release>, func_data=0x0,
    args=0xbfbff44c) at gtkmarshal.c:28
#41 0x83488c4 in gtk_signal_real_emit (object=0x8828f00, signal_id=21,
    params=0xbfbff44c) at gtksignal.c:1492
#42 0x8345f76 in gtk_signal_emit (object=0x8828f00, signal_id=21)
    at gtksignal.c:552
#43 0x8385785 in gtk_widget_event (widget=0x8828f00, event=0x8899018)
    at gtkwidget.c:2860
#44 0x830d877 in gtk_propagate_event (widget=0x8828f00, event=0x8899018)
    at gtkmain.c:1313
#45 0x830c740 in gtk_main_do_event (event=0x8899018) at gtkmain.c:770
#46 0x83aa913 in gdk_event_dispatch (source_data=0x0,
current_time=0xbfbff84c,
    user_data=0x0) at gdkevents.c:2129
#47 0x84592f5 in g_main_dispatch () at xap_UnixPSImage.cpp:199
#48 0x84598bd in g_main_iterate () at xap_UnixPSImage.cpp:199
#49 0x8459a04 in g_main_run () at xap_UnixPSImage.cpp:199
#50 0x830be6c in gtk_main () at gtkmain.c:476
#51 0x8048731 in AP_UnixGnomeApp::main (
    szAppName=0x84ad361 "AbiWord Personal", argc=1, argv=0xbfbff9e8)
    at ap_UnixGnomeApp.cpp:179
#52 0x80481bb in main (argc=1, argv=0xbfbff9e8) at UnixGnomeMain.cpp:24
#53 0x8048139 in _start ()



This archive was generated by hypermail 2b25 : Mon Aug 28 2000 - 23:58:10 CDT