Re: How should I fix crash during error dialogs with GTK?


Subject: Re: How should I fix crash during error dialogs with GTK?
From: Peter Haight (peterh@sapros.com)
Date: Tue Aug 29 2000 - 14:36:34 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 easiest way to fix this is to update "abidistfiles" from CVS. The next
>thing someone has to do is to stop asserts in the gno debug build
>immediately crashing abi. It's one reason I mostly do unix builds do.

Why update abidistfiles? What is in there that affects this issue? I pretty
much had the latest version as of yesterday. I think you are right about not
having the asserts crash abi. On the other hand, it is a great motivator for
me to figure out the problem. But the default should be no crash.

>> 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.
>>
>
>Actually it doesn't. The insert symbol dialog is modeless and does not
>block with gtk_main().

Ahh. I didn't explain correctly. The dialog box that runs gtk_main() is not
the Insert Symbol dialog, it is the dialog created by messageBoxOK(). Take a
look at the stack trace I sent in my last email. You'll see it is an signal
fired off by the gtk_main called from messageBoxOK() that causes all the
problems.

>Are you using the CVS build?

Yep. Updated right before I looked into all this.

Just for your info, here's a patch that fixes the problem. It just moves
_connectSignals so that the signals don't get setup until after the
Insert Symbol dialog is ready to handle them. I don't think it is the right
fix, though. It would be better if 'messageBoxOk' didn't call any signals
for other windows (at least for error messages).

Index: src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp,v
retrieving revision 1.16
diff -u -b -r1.16 xap_UnixDlg_Insert_Symbol.cpp
--- src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp 2000/07/09 18:11:51
1.16
+++ src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp 2000/08/29 19:30:46
@@ -251,6 +251,7 @@
        m_PreviousSymbol = m_CurrentSymbol;
        iDrawSymbol->drawarea(m_CurrentSymbol, m_PreviousSymbol);

+ _connectSignals();
        // return to ap_Editmethods and wait for something interesting
        // to happen.
 }
@@ -483,8 +484,6 @@
        GTK_WIDGET_SET_FLAGS (m_buttonCancel, GTK_CAN_DEFAULT);

        gtk_widget_show (hboxInsertS);
-
- _connectSignals ();

        gtk_widget_grab_focus (m_buttonOK);
        gtk_widget_grab_default (m_buttonOK);

Index: src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp,v
retrieving revision 1.16
diff -u -b -r1.16 xap_UnixDlg_Insert_Symbol.cpp
--- src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp 2000/07/09 18:11:51
1.16
+++ src/af/xap/unix/xap_UnixDlg_Insert_Symbol.cpp 2000/08/29 19:30:46
@@ -251,6 +251,7 @@
        m_PreviousSymbol = m_CurrentSymbol;
        iDrawSymbol->drawarea(m_CurrentSymbol, m_PreviousSymbol);

+ _connectSignals();
        // return to ap_Editmethods and wait for something interesting
        // to happen.
 }
@@ -483,8 +484,6 @@
        GTK_WIDGET_SET_FLAGS (m_buttonCancel, GTK_CAN_DEFAULT);

        gtk_widget_show (hboxInsertS);
-
- _connectSignals ();

        gtk_widget_grab_focus (m_buttonOK);
        gtk_widget_grab_default (m_buttonOK);



This archive was generated by hypermail 2b25 : Tue Aug 29 2000 - 14:37:20 CDT