superslicer-2.5.59.2-fix-dereferencing-in-std-unique_ptr-to-nullptr.patch 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
  2. index 68ec2ce..cd828a6 100644
  3. --- a/src/libslic3r/GCode.cpp
  4. +++ b/src/libslic3r/GCode.cpp
  5. @@ -2081,31 +2081,30 @@ void GCode::process_layers(
  6. }
  7. });
  8. const auto spiral_vase = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
  9. - [&spiral_vase = *this->m_spiral_vase](LayerResult in) -> LayerResult {
  10. + [spiral_vase = this->m_spiral_vase.get()](LayerResult in) -> LayerResult {
  11. if (in.nop_layer_result)
  12. return in;
  13. CNumericLocalesSetter locales_setter;
  14. - spiral_vase.enable(in.spiral_vase_enable);
  15. - return LayerResult{ spiral_vase.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush };
  16. + spiral_vase->enable(in.spiral_vase_enable);
  17. + return { spiral_vase->process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush};
  18. });
  19. const auto pressure_equalizer = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
  20. - [&pressure_equalizer = *this->m_pressure_equalizer](LayerResult in) -> LayerResult {
  21. - return pressure_equalizer.process_layer(std::move(in));
  22. + [pressure_equalizer = this->m_pressure_equalizer.get()](LayerResult in) -> LayerResult {
  23. + return pressure_equalizer->process_layer(std::move(in));
  24. });
  25. const auto cooling = tbb::make_filter<LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
  26. - [&cooling_buffer = *this->m_cooling_buffer](LayerResult in) -> std::string {
  27. + [cooling_buffer = this->m_cooling_buffer.get()](LayerResult in)->std::string {
  28. if (in.nop_layer_result)
  29. return in.gcode;
  30. CNumericLocalesSetter locales_setter;
  31. - return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush);
  32. + return cooling_buffer->process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush);
  33. });
  34. const auto find_replace = tbb::make_filter<std::string, std::string>(slic3r_tbb_filtermode::serial_in_order,
  35. - [&self = *this->m_find_replace](std::string s) -> std::string {
  36. - CNumericLocalesSetter locales_setter;
  37. - return self.process_layer(std::move(s));
  38. - });
  39. + [find_replace = this->m_find_replace.get()](std::string s) -> std::string {
  40. + return find_replace->process_layer(std::move(s));
  41. +});
  42. const auto output = tbb::make_filter<std::string, void>(slic3r_tbb_filtermode::serial_in_order,
  43. [&output_stream](std::string s) {
  44. CNumericLocalesSetter locales_setter;
  45. @@ -2183,25 +2182,26 @@ void GCode::process_layers(
  46. }
  47. });
  48. const auto spiral_vase = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
  49. - [&spiral_vase = *this->m_spiral_vase](LayerResult in)->LayerResult {
  50. + [spiral_vase = this->m_spiral_vase.get()](LayerResult in) -> LayerResult {
  51. if (in.nop_layer_result)
  52. return in;
  53. - spiral_vase.enable(in.spiral_vase_enable);
  54. - return { spiral_vase.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush };
  55. + spiral_vase->enable(in.spiral_vase_enable);
  56. + return { spiral_vase->process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush};
  57. });
  58. const auto pressure_equalizer = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
  59. - [&pressure_equalizer = *this->m_pressure_equalizer](LayerResult in) -> LayerResult {
  60. - return pressure_equalizer.process_layer(std::move(in));
  61. + [pressure_equalizer = this->m_pressure_equalizer.get()](LayerResult in) -> LayerResult {
  62. + return pressure_equalizer->process_layer(std::move(in));
  63. });
  64. const auto cooling = tbb::make_filter<LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
  65. - [&cooling_buffer = *this->m_cooling_buffer](LayerResult in)->std::string {
  66. + [cooling_buffer = this->m_cooling_buffer.get()](LayerResult in) -> std::string {
  67. if (in.nop_layer_result)
  68. return in.gcode;
  69. - return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush);
  70. + return cooling_buffer->process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush);
  71. +
  72. });
  73. const auto find_replace = tbb::make_filter<std::string, std::string>(slic3r_tbb_filtermode::serial_in_order,
  74. - [&self = *this->m_find_replace](std::string s) -> std::string {
  75. - return self.process_layer(std::move(s));
  76. + [find_replace = this->m_find_replace.get()](std::string s) -> std::string {
  77. + return find_replace->process_layer(std::move(s));
  78. });
  79. const auto output = tbb::make_filter<std::string, void>(slic3r_tbb_filtermode::serial_in_order,
  80. [&output_stream](std::string s) {