From 7a851424152a942443190ac34856c08d8dfe7580 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 14 Jul 2015 15:32:48 +0200 Subject: fixed error message for Qq if does not exist * the problem comes from StateExpectQReg resetting the QRegMachine too early. StateExpectQReg(QREG_OPTIONAL) states cannot call machine.fail() in their got_register() callback. In other words, commands with both optional or required registers depending on runtime state cannot be modelled with StateExpectQReg. * instead we derive from State directly - most functionality is encapsulated in QRegSpecMachine anyway. * might also fix crashes on some systems. --- src/qregisters.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/qregisters.h') diff --git a/src/qregisters.h b/src/qregisters.h index 1c55066..48b023d 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -466,12 +466,14 @@ private: State *got_file(const gchar *filename); }; -class StateQueryQReg : public StateExpectQReg { +class StateQueryQReg : public State { + QRegSpecMachine machine; + public: - StateQueryQReg() : StateExpectQReg(QREG_OPTIONAL) {} + StateQueryQReg(); private: - State *got_register(QRegister *reg); + State *custom(gchar chr); }; class StateCtlUCommand : public StateExpectQReg { -- cgit v1.2.3