]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlCommand.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlCommand.C
index 07a0408e93f41bb4487eff18e16826bd05812856..0fa8df22f8f6c62e0e8c3ab2cb899d2d1428ecb0 100644 (file)
 #include <config.h>
 
 #include "ControlCommand.h"
-#include "Kernel.h"
 
 #include "funcrequest.h"
 #include "insets/insetcommand.h"
 
 
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
 ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
        : Dialog::Controller(dialog),
          lfun_name_(lfun_name)
@@ -25,16 +29,16 @@ ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
 
 bool ControlCommand::initialiseParams(string const & data)
 {
-       InsetCommandMailer::string2params(data, params_);
+       // The name passed with LFUN_INSET_APPLY is also the name
+       // used to identify the mailer.
+       InsetCommandMailer::string2params(lfun_name_, data, params_);
        return true;
 }
 
 
 void ControlCommand::clearParams()
 {
-       params_.setCmdName(string());
-       params_.setOptions(string());
-       params_.setContents(string());
+       params_ = InsetCommandParams();
 }
 
 
@@ -45,5 +49,8 @@ void ControlCommand::dispatchParams()
 
        string const lfun = InsetCommandMailer::params2string(lfun_name_,
                                                              params_);
-       kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
+       kernel().dispatch(FuncRequest(getLfun(), lfun));
 }
+
+} // namespace frontend
+} // namespace lyx