Fix crash on clicking EngineOutput window after using menu dialog
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 7 Jan 2010 15:19:25 +0000 (16:19 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 7 Jan 2010 15:19:25 +0000 (16:19 +0100)
The copy-from-engine-output patch involved calling SetFocus for the
EngineOutput memos, which led to a crash if the last focus-carrying
widget was in the mean time destroyed by closing the dialog. The various
dialog-PopDown functions now invalidate the active widget.

xoptions.c

index 7532dab..3151c31 100644 (file)
@@ -246,6 +246,7 @@ int tcIncrement, tcMoves;
 void TimeControlPopDown()
 {
     if (!TimeControlUp) return;
+    previous = NULL;
     XtPopdown(TimeControlShell);
     XtDestroyWidget(TimeControlShell);
     TimeControlUp = False;
@@ -568,6 +569,7 @@ Widget engDrawMoves, engThreshold, engRule, engRepeat;
 void EnginePopDown()
 {
     if (!EngineUp) return;
+    previous = NULL;
     XtPopdown(EngineShell);
     XtDestroyWidget(EngineShell);
     EngineUp = False;
@@ -1126,6 +1128,7 @@ struct UciControl controlDesc[] = {
 void UciPopDown()
 {
     if (!UciUp) return;
+    previous = NULL;
     XtPopdown(UciShell);
     XtDestroyWidget(UciShell);
     UciUp = False;
@@ -1324,6 +1327,7 @@ ChessProgramState *currentCps;
 void SettingsPopDown()
 {
     if (!SettingsUp) return;
+    previous = NULL;
     XtPopdown(SettingsShell);
     XtDestroyWidget(SettingsShell);
     SettingsUp = False;