DroidFish: Display an error message if an engine is terminated prematurely.

This commit is contained in:
Peter Osterlund
2012-01-07 23:29:51 +00:00
parent ae985c5ed5
commit b97830c29a
2 changed files with 6 additions and 2 deletions

View File

@@ -408,6 +408,7 @@ you are not actively using the program.\
<string name="stockfish_engine">Stockfish</string> <string name="stockfish_engine">Stockfish</string>
<string name="cuckoochess_engine">CuckooChess</string> <string name="cuckoochess_engine">CuckooChess</string>
<string name="failed_to_start_engine">Failed to start engine</string> <string name="failed_to_start_engine">Failed to start engine</string>
<string name="engine_terminated">Engine terminated</string>
<string name="err_too_few_spaces">Too few spaces</string> <string name="err_too_few_spaces">Too few spaces</string>
<string name="err_invalid_piece">Invalid piece</string> <string name="err_invalid_piece">Invalid piece</string>

View File

@@ -75,6 +75,9 @@ public class ExternalEngine extends UCIEngineBase {
engineProc.waitFor(); engineProc.waitFor();
if (!startedOk) if (!startedOk)
report.reportError(context.getString(R.string.failed_to_start_engine)); report.reportError(context.getString(R.string.failed_to_start_engine));
else {
report.reportError(context.getString(R.string.engine_terminated));
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
} }
@@ -184,12 +187,12 @@ public class ExternalEngine extends UCIEngineBase {
/** @inheritDoc */ /** @inheritDoc */
@Override @Override
public void shutDown() { public void shutDown() {
if (exitThread != null)
exitThread.interrupt();
super.shutDown(); super.shutDown();
if (engineProc != null) if (engineProc != null)
engineProc.destroy(); engineProc.destroy();
engineProc = null; engineProc = null;
if (exitThread != null)
exitThread.interrupt();
if (stdInThread != null) if (stdInThread != null)
stdInThread.interrupt(); stdInThread.interrupt();
if (stdErrThread != null) if (stdErrThread != null)