From d824de61683f76087c27bee00616fc6bb1225d26 Mon Sep 17 00:00:00 2001 From: "Y. Sapir" Date: Mon, 28 Apr 2014 00:03:22 +0300 Subject: [PATCH] Keep pointer to PrintConfig instead of copying it. --- xs/src/Extruder.cpp | 4 ++-- xs/src/Extruder.hpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xs/src/Extruder.cpp b/xs/src/Extruder.cpp index 3dce80ea7..2f5a82469 100644 --- a/xs/src/Extruder.cpp +++ b/xs/src/Extruder.cpp @@ -7,7 +7,7 @@ namespace Slic3r { Extruder::Extruder(int id, PrintConfig *config) : id(id), - config(*config) // make a copy + config(config) { reset(); } @@ -37,7 +37,7 @@ bool Extruder::use_relative_e_distances() const { // TODO: figure out way to avoid static_cast to access hidden const method - const ConfigOption *opt = static_cast(&this->config) + const ConfigOption *opt = static_cast(this->config) ->option("use_relative_e_distances"); return *static_cast(opt); } diff --git a/xs/src/Extruder.hpp b/xs/src/Extruder.hpp index 8fd70ee53..1ab7fd16e 100644 --- a/xs/src/Extruder.hpp +++ b/xs/src/Extruder.hpp @@ -23,8 +23,7 @@ class Extruder double retracted; double restart_extra; - // TODO: maybe better to keep a reference to an existing object than copy it - PrintConfig config; + PrintConfig *config; }; }