Fixed a GCode preview crash on Linux due to returning a reference to temporary (issue #872)
This commit is contained in:
parent
9af6a89f20
commit
d89f8128cd
3 changed files with 3 additions and 5 deletions
|
@ -275,7 +275,7 @@ bool GCodePreviewData::empty() const
|
||||||
return extrusion.layers.empty() && travel.polylines.empty() && retraction.positions.empty() && unretraction.positions.empty();
|
return extrusion.layers.empty() && travel.polylines.empty() && retraction.positions.empty() && unretraction.positions.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
const GCodePreviewData::Color& GCodePreviewData::get_extrusion_role_color(ExtrusionRole role) const
|
GCodePreviewData::Color GCodePreviewData::get_extrusion_role_color(ExtrusionRole role) const
|
||||||
{
|
{
|
||||||
return extrusion.role_colors[role];
|
return extrusion.role_colors[role];
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|
||||||
const Color& get_extrusion_role_color(ExtrusionRole role) const;
|
Color get_extrusion_role_color(ExtrusionRole role) const;
|
||||||
Color get_height_color(float height) const;
|
Color get_height_color(float height) const;
|
||||||
Color get_width_color(float width) const;
|
Color get_width_color(float width) const;
|
||||||
Color get_feedrate_color(float feedrate) const;
|
Color get_feedrate_color(float feedrate) const;
|
||||||
|
|
|
@ -2204,7 +2204,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const GCodePreviewData::Color& path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value)
|
static const GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value)
|
||||||
{
|
{
|
||||||
switch (data.extrusion.view_type)
|
switch (data.extrusion.view_type)
|
||||||
{
|
{
|
||||||
|
@ -2257,7 +2257,6 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Filter> FiltersList;
|
typedef std::vector<Filter> FiltersList;
|
||||||
|
|
||||||
size_t initial_volumes_count = volumes.volumes.size();
|
size_t initial_volumes_count = volumes.volumes.size();
|
||||||
|
|
||||||
// detects filters
|
// detects filters
|
||||||
|
@ -2281,7 +2280,6 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
|
||||||
for (Filter& filter : filters)
|
for (Filter& filter : filters)
|
||||||
{
|
{
|
||||||
s_gcode_preview_volume_index.first_volumes.emplace_back(GCodePreviewVolumeIndex::Extrusion, (unsigned int)filter.role, (unsigned int)volumes.volumes.size());
|
s_gcode_preview_volume_index.first_volumes.emplace_back(GCodePreviewVolumeIndex::Extrusion, (unsigned int)filter.role, (unsigned int)volumes.volumes.size());
|
||||||
|
|
||||||
GLVolume* volume = new GLVolume(Helper::path_color(preview_data, tool_colors, filter.value).rgba);
|
GLVolume* volume = new GLVolume(Helper::path_color(preview_data, tool_colors, filter.value).rgba);
|
||||||
if (volume != nullptr)
|
if (volume != nullptr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue