Fix crash on using Browse buttons in Tournament dialog Xaw
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 11 Nov 2014 13:40:43 +0000 (14:40 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 7 May 2015 18:53:31 +0000 (20:53 +0200)
The Xaw file browser assumes the text entries it is browsing for are
all in dialogs of the class TransienDlg, but the Tournament Options
dialog has been altered to MasterDlg, to allow it to co-exist with
Time Control and Common-Engine dialog (which can be opened through
buttons in it). Xaw did not like that, and the true DialogClass is
now used when setting the widget text.

dialogs.c

index 45209e6..2e63442 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -2724,6 +2724,7 @@ DisplayMessage (char *message, char *extMessage)
 
 #define MAXFILES 1000
 
+static DialogClass savDlg;
 static ChessProgramState *savCps;
 static FILE **savFP;
 static char *fileName, *extFilter, *savMode, **namePtr;
@@ -2806,7 +2807,7 @@ BrowseOK (int n)
                    snprintf(title, MSG_SIZ, "%s", fileName);
                else
                    snprintf(title, MSG_SIZ, "%s/%s", curDir, fileName);
-               SetWidgetText((Option*) savFP, title, TransientDlg);
+               SetWidgetText((Option*) savFP, title, savDlg);
                currentCps = savCps; // could return to Engine Settings dialog!
                return TRUE;
        }
@@ -2963,7 +2964,7 @@ void
 Browse (DialogClass dlg, char *label, char *proposed, char *ext, Boolean pathFlag, char *mode, char **name, FILE **fp)
 {
     int j=0;
-    savFP = fp; savMode = mode, namePtr = name, savCps = currentCps, oldVal = values[9]; // save params, for use in callback
+    savFP = fp; savMode = mode, namePtr = name, savCps = currentCps, oldVal = values[9], savDlg = dlg; // save params, for use in callback
     ASSIGN(extFilter, ext);
     ASSIGN(fileName, proposed ? proposed : "");
     for(j=0; Extensions[j]; j++) // look up actual value in list of possible values, to get selection nr