From 58062637311ced0be7cdbac67e26cb0528784aa0 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 24 Feb 2023 14:49:02 +0800 Subject: [PATCH] FIX: cli: fix a crash caused by log Change-Id: I3dad5a47241ff57818e68fda58d7f70f497bf5e1 --- src/BambuStudio.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index add097032..d4a565530 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -1012,6 +1012,7 @@ int CLI::run(int argc, char **argv) for (const t_config_option_key &opt_key : config.keys()) { if (!diff_key_sets.empty() && (diff_key_sets.find(opt_key) != diff_key_sets.end())) { //uptodate, diff keys, continue + BOOST_LOG_TRIVIAL(info) << boost::format("keep key %1%")%opt_key; continue; } const ConfigOption *source_opt = config.option(opt_key); @@ -1056,6 +1057,7 @@ int CLI::run(int argc, char **argv) } std::set different_keys_set(different_keys.begin(), different_keys.end()); + BOOST_LOG_TRIVIAL(info) << boost::format("update printer config to newest, different size %1%")%different_keys_set.size(); int ret = update_full_config(m_print_config, load_machine_config, different_keys_set); if (ret) flush_and_exit(ret); @@ -1093,6 +1095,7 @@ int CLI::run(int argc, char **argv) } std::set different_keys_set(different_keys.begin(), different_keys.end()); + BOOST_LOG_TRIVIAL(info) << boost::format("update process config to newest, different size %1%")%different_keys_set.size(); int ret = update_full_config(m_print_config, load_machine_config, different_keys_set); if (ret) flush_and_exit(ret); @@ -1158,9 +1161,11 @@ int CLI::run(int argc, char **argv) //parse the filament value to index th //loop through options and apply them std::set different_keys_set(different_keys.begin(), different_keys.end()); + BOOST_LOG_TRIVIAL(info) << boost::format("update filament %1%'s config to newest, different size %2%")%filament_index%different_keys_set.size(); for (const t_config_option_key &opt_key : config.keys()) { if (!different_keys_set.empty() && (different_keys_set.find(opt_key) != different_keys_set.end())) { //uptodate, diff keys, continue + BOOST_LOG_TRIVIAL(info) << boost::format("keep key %1%")%opt_key; continue; } // Create a new option with default value for the key. @@ -1170,7 +1175,7 @@ int CLI::run(int argc, char **argv) const ConfigOption *source_opt = config.option(opt_key); if (source_opt == nullptr) { // The key was not found in the source config, therefore it will not be initialized! - boost::nowide::cerr << "can not found option " <is_scalar()) { @@ -1190,7 +1195,7 @@ int CLI::run(int argc, char **argv) } else { //skip the scalar values - BOOST_LOG_TRIVIAL(warning) << "skip scalar option " <def(). // This is only possible if other is of DynamicConfig type. - boost::nowide::cerr << "can not create option " <(opt);