Fix Error popup in Tournament Options
[xboard.git] / dialogs.c
index 86ea1d3..4b52d26 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -1,7 +1,7 @@
 /*
  * dialogs.c -- platform-independent code for dialogs of XBoard
  *
- * Copyright 2000, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+ * Copyright 2000, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
  * ------------------------------------------------------------------------
  *
  * GNU XBoard is free software: you can redistribute it and/or modify
@@ -331,8 +331,10 @@ UpgradeParticipant ()
 static void
 PseudoOK ()
 {
+    if(matchMode) return;
     GenericReadout(matchOptions, -2); // read all, but suppress calling of MatchOK
     ASSIGN(appData.participants, engineName);
+    ASSIGN(appData.tourneyFile, tfName);
     PopDown(MasterDlg); // early popdown to prevent FreezeUI called through MatchEvent from causing XtGrab warning
 }
 
@@ -1771,7 +1773,7 @@ PromotionPopUp (char choice)
 { // choice depends on variant: prepare dialog acordingly
   count = 8;
   SetPromo(_("Cancel"), --count, -1); // Beware: GenericPopUp cannot handle user buttons named "cancel" (lowe case)!
-  if(choice != '+') {
+  if(choice != '+' && !IS_SHOGI(gameInfo.variant)) {
     if (!appData.testLegality || gameInfo.variant == VariantSuicide ||
         gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) ||
         gameInfo.variant == VariantGiveaway) {
@@ -1944,6 +1946,7 @@ OutputChatMessage (int partner, char *mess)
     char *p = texts[partner];
     int len = strlen(mess) + 1;
 
+    if(!DialogExists(ChatDlg)) return;
     if(p) len += strlen(p);
     texts[partner] = (char*) malloc(len);
     snprintf(texts[partner], len, "%s%s", p ? p : "", mess);
@@ -2261,8 +2264,8 @@ ErrorPopUp (char *title, char *label, int modal)
 {
     errorUp = True;
     errorOptions[1].name = label;
-    if(dialogError = shellUp[TransientDlg])
-       GenericPopUp(errorOptions+1, title, FatalDlg, TransientDlg, MODAL, 0); // pop up as daughter of the transient dialog
+    if(dialogError = shellUp[MasterDlg])
+       GenericPopUp(errorOptions+1, title, FatalDlg, MasterDlg, MODAL, 0); // pop up as daughter of the transient dialog
     else
        GenericPopUp(errorOptions+modal, title, modal ? FatalDlg: ErrorDlg, BoardWindow, modal, 0); // kludge: option start address indicates modality
 }