[Freeciv-Dev] Re: (PR#2794) segfault in civclient (1.14.0beta3)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
I've found the problem.
I realized that the crash actually happens *always* when a new message
is added to the message window while the window isn't open, and the new
message causes scrolling (i.e. there are already >= N_MSG_VIEW
messages). The problem is that scrolling doesn't work unless the message
window is actually visible: The "viewport.child" component of the
viewport widget (normally pointing to the list widget) isn't set
otherwise, thus causing XawViewportSetCoordinates() to crash.
I've no idea whether this is correct behaviour or a bug in Xaw, neither
why the problem didn't occur before. (I'm not aware of having changed
anything in my system configuration.)
I've created the following workaround, which uses a flag to prevent
scrolling before the window is acutally popped up:
--- messagewin.c.orig 2003-01-17 05:11:18.000000000 +0100
+++ messagewin.c 2003-01-17 05:10:10.000000000 +0100
@@ -106,8 +106,13 @@
/****************************************************************
...
*****************************************************************/
+static bool creating; /* we are just creating message window, not popped up
+ yet (don't scroll -- Xaw may crash otherwise!) */
+
static void create_meswin_dialog(void)
{
+ creating=1;
+
meswin_dialog_shell =
I_IN(I_T(XtCreatePopupShell("meswinpopup", topLevelShellWidgetClass,
toplevel, NULL, 0)));
@@ -169,6 +174,7 @@
XtOverrideTranslations(meswin_dialog_shell,
XtParseTranslationTable("<Message>WM_PROTOCOLS: msg-close-messages()"));
+ creating=0;
}
/**************************************************************************
@@ -185,7 +191,7 @@
Dimension height;
int pos;
- if (!meswin_dialog_shell)
+ if (!meswin_dialog_shell || creating)
return;
if (get_num_messages() <= N_MSG_VIEW) {
return;
I guess there is a more elegant solution, using Xaw functions/data
structures to determine whether the window is visible. However, I'd
rather write a bigger patch, considerably changing the message window
handling, so that such a situation can't occur in the first place.
(While hunting down the bug I realized that the code is quite messy,
causing superfluous actions etc... Seems somewhere between maintaier
changes people lost track what's actually happening there.)
-Olaf-
--
Don't buy away your freedom -- GNU/Linux
|
|