From 1ff7214532a19ea844355b6e1ff1c76b2bc6fbe1 Mon Sep 17 00:00:00 2001
From: YuSanka <yusanka@gmail.com>
Date: Tue, 7 Dec 2021 14:40:39 +0100
Subject: [PATCH] Fix for endless loop dialog - see
 https://github.com/prusa3d/PrusaSlicer/issues/7419#issuecomment-986325432

When part's configuration is updated =>
Don't call config_manipulation.update_print_fff_config() separately for applied object's config and then applied own config.
Configuration have to be applied from object config and its config. And than call config_manipulation.update_print_fff_config().

+ Redundant call of the update_config_values() is deleted from DeleteButton event. All checks are made during update_settings_list().
---
 src/slic3r/GUI/GUI_ObjectSettings.cpp | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp
index c92ddd3b5..c9a7cd330 100644
--- a/src/slic3r/GUI/GUI_ObjectSettings.cpp
+++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp
@@ -110,12 +110,6 @@ bool ObjectSettings::update_settings_list()
                     update_settings_list(); 
                     m_parent->Layout(); 
                 });
-
-                /* Check overriden options list after deleting.
-                 * Some options couldn't be deleted because of another one.
-                 * Like, we couldn't delete fill pattern, if fill density is set to 100%
-                 */
-                update_config_values(config);
 			});
 			return btn;
 		};
@@ -227,11 +221,12 @@ void ObjectSettings::update_config_values(ModelConfig* config)
         update_config_values(config);
 
         if (is_added) {
-            wxTheApp->CallAfter([this]() {
+// #ysFIXME - Delete after testing! Very likely this CallAfret is no needed
+//            wxTheApp->CallAfter([this]() {
                 wxWindowUpdateLocker noUpdates(m_parent);
                 update_settings_list();
                 m_parent->Layout();
-            });
+//            });
         }
     };
 
@@ -253,9 +248,9 @@ void ObjectSettings::update_config_values(ModelConfig* config)
     {
         const int obj_idx = objects_model->GetObjectIdByItem(item);
         assert(obj_idx >= 0);
+        // for object's part first of all update konfiguration from object 
         main_config.apply(wxGetApp().model().objects[obj_idx]->config.get(), true);
-        printer_technology == ptFFF  ?  config_manipulation.update_print_fff_config(&main_config) :
-                                        config_manipulation.update_print_sla_config(&main_config) ;
+        // and then from its own config
     }
 
     main_config.apply(config->get(), true);