mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 03:16:01 +08:00
Fixed a crash in a constructor of FullPrintConfig due to an incorrect use
of virtual inheritance. Note that an invocation of ConfigBase::optptr() is routed to FullPrintConfig::optptr() for all classes of the FullPrintConfig hierarchy. FullPrintConfig::optptr() in turn invokes optptr() of PrintObjectConfig, PrintRegionConfig, PrintConfig and HostConfig. Due to the use of virtual inheritance, this all happens, when PrintObjectConfig gets constructed as part of FullPrintConfig, but at that time PrintRegionConfig, PrintConfig and HostConfig are not constructed yet. Accessing them at that time leads to crashes, when compiled with Visual Studio 2013 compiler. For some reason the code generated by gcc does not crash, but I believe the behavior is undefined and it is better to be fixed anyway. The patch solves the problem by calling set_defaults() by the topmost object, which not only fixes the crashes, but also avoids repeated initialization. Conflicts: xs/src/libslic3r/PrintConfig.hpp
This commit is contained in:
parent
96dd99c1f8
commit
08287e76e5
@ -163,7 +163,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig
|
||||
if (initialize)
|
||||
this->set_defaults();
|
||||
}
|
||||
|
||||
|
||||
virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(dont_support_bridges);
|
||||
OPT_PTR(extrusion_width);
|
||||
@ -234,7 +234,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig
|
||||
if (initialize)
|
||||
this->set_defaults();
|
||||
}
|
||||
|
||||
|
||||
virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(bottom_solid_layers);
|
||||
OPT_PTR(bridge_flow_ratio);
|
||||
@ -409,7 +409,7 @@ class PrintConfig : public GCodeConfig
|
||||
if (initialize)
|
||||
this->set_defaults();
|
||||
}
|
||||
|
||||
|
||||
virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(avoid_crossing_perimeters);
|
||||
OPT_PTR(bed_shape);
|
||||
@ -482,7 +482,7 @@ class HostConfig : public virtual StaticPrintConfig
|
||||
if (initialize)
|
||||
this->set_defaults();
|
||||
}
|
||||
|
||||
|
||||
virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(octoprint_host);
|
||||
OPT_PTR(octoprint_apikey);
|
||||
|
Loading…
x
Reference in New Issue
Block a user