From a54de942a37813d4c303a74e68a86b24cb756010 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 23 Nov 2021 12:26:11 +0200 Subject: [PATCH] - added a few protections against RuntimeError exceptions that randomly popup due of wrapped C++ objects being deleted --- CHANGELOG.md | 4 ++++ appObjects/FlatCAMObj.py | 8 +++++++- app_Main.py | 5 ++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8164a88..c317a0cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +23.11.2021 + +- added a few protections against RuntimeError exceptions that randomly popup due of wrapped C++ objects being deleted + 22.11.2021 - in AppTextEditor made some changes (added some placeholders and a message popup when reaching the end of document) diff --git a/appObjects/FlatCAMObj.py b/appObjects/FlatCAMObj.py index 1890c1c1..0e1d44f5 100644 --- a/appObjects/FlatCAMObj.py +++ b/appObjects/FlatCAMObj.py @@ -312,7 +312,13 @@ class FlatCAMObj(QtCore.QObject): except Exception as e: self.app.log.error("FlatCAMObj.build_ui() --> Nothing to remove: %s" % str(e)) - self.app.ui.properties_scroll_area.setWidget(self.ui) + try: + self.app.ui.properties_scroll_area.setWidget(self.ui) + except RuntimeError: + try: + self.app.ui.properties_scroll_area.setWidget(self.ui) + except Exception: + pass # self.ui.setMinimumWidth(100) # self.ui.setMaximumWidth(self.app.ui.properties_tab.sizeHint().width()) diff --git a/app_Main.py b/app_Main.py index d64cd0f3..f28959a6 100644 --- a/app_Main.py +++ b/app_Main.py @@ -8443,7 +8443,10 @@ class App(QtCore.QObject): if self.ui.notebook.tabText(self.ui.notebook.currentIndex()) == _("Properties"): active_obj = self.collection.get_active() if active_obj: - active_obj.build_ui() + try: + active_obj.build_ui() + except Exception: + self.setup_default_properties_tab() else: self.setup_default_properties_tab()