From abcf526d706b39afd25aab67b922cc903c626c9d Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 22 Jan 2018 15:43:11 +0300 Subject: [PATCH] Fix for the issue #2417 : human name for a generic error --- src/BuildPlugin/BuildPlugin_Validators.cpp | 4 ++++ src/ModelAPI/ModelAPI_Tools.cpp | 12 +++++------- src/XGUI/XGUI_WorkshopListener.cpp | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/BuildPlugin/BuildPlugin_Validators.cpp b/src/BuildPlugin/BuildPlugin_Validators.cpp index 8c58b4777..99140d20e 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.cpp +++ b/src/BuildPlugin/BuildPlugin_Validators.cpp @@ -279,6 +279,10 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid( ListOfShape anOriginalShapes; for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); + if (!aSelection->context().get()) { + theError = "Invalid selection."; + return false; + } GeomShapePtr aShape = aSelection->value(); if (!aShape.get()) aShape = aSelection->context()->shape(); diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index ddd809ed6..946994559 100755 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -109,16 +109,14 @@ std::shared_ptr shape(const ResultPtr& theResult) const char* toString(ModelAPI_ExecState theExecState) { -#define TO_STRING(__NAME__) case __NAME__: return #__NAME__; switch (theExecState) { - TO_STRING(ModelAPI_StateDone) - TO_STRING(ModelAPI_StateMustBeUpdated) - TO_STRING(ModelAPI_StateExecFailed) - TO_STRING(ModelAPI_StateInvalidArgument) - TO_STRING(ModelAPI_StateNothing) + case ModelAPI_StateDone: return "Done"; + case ModelAPI_StateMustBeUpdated: return "Must be updated"; + case ModelAPI_StateExecFailed: return "Execution failed"; + case ModelAPI_StateInvalidArgument: return "Invalid argument"; + case ModelAPI_StateNothing: return "Empty state"; default: return "Unknown ExecState."; } -#undef TO_STRING } std::string getFeatureError(const FeaturePtr& theFeature) diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index fd5c11630..4b3546211 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -119,7 +119,8 @@ void XGUI_WorkshopListener::initializeEventListening() //****************************************************** void XGUI_WorkshopListener::processEvent(const std::shared_ptr& theMessage) { - if (QApplication::instance()->thread() != QThread::currentThread()) { + if (QApplication::instance() && + QApplication::instance()->thread() != QThread::currentThread()) { #ifdef _DEBUG std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl; #endif -- 2.39.2