command-line control of modal dialogs is broken
How to reproduce
Launch executable demo1_triggerbutton. Enter "quit" in the console. App will freeze.
Similarly, Steca will freeze when commands are entered while a modal dialog is open. Simplest example is the "About" dialog.
Analysis
The error has been introduced in !28 (merged), which was an attempt to fix #1 (closed).
[&mw](QSocketDescriptor, QSocketNotifier::Type type) {
if (type == QSocketNotifier::Read) {
QTextStream qtin{stdin};
// .... Variant A ....
mw.onCommand(qtin.readLine());
// .... Variant B ....
do {
mw.onCommand(qtin.readLine());
} while (!qtin.atEnd());
// .... End of variants
}
});
The old code, Variant A, works fine - as long as I enter the input manually, line by line. However, it fails if I paste a multi-line text block to stdin, or pipe a file to stdin.
The current code, Variant B, correctly reads copied & pasted multi-line input - but then it blocks the application forever; the "quit" button in the GUI no longer reacts to clicks.
Hoping for clue at https://forum.qt.io/topic/158084.
Edited by Wuttke, Joachim