Salome HOME
Fix for crash on multi-selection of group-vertices on imported body with Shift-key...
[modules/shaper.git] / src / ModuleBase / ModuleBase_FilterValidated.cpp
index a6336d3533360bdf3c7c3f7e345ca44a297a4dfe..28a43c3d7ee28b0d3bd7046a9817bff49ca87e82 100644 (file)
@@ -9,8 +9,10 @@
 
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ISelection.h>
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_WidgetValidated.h>
+#include <ModuleBase_ViewerPrs.h>
 
 IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterValidated, SelectMgr_Filter);
 IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter);
@@ -18,11 +20,16 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter);
 Standard_Boolean ModuleBase_FilterValidated::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
   ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
-  ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
+  if (!anOperation)
+    return true;
 
+  ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
   ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
   ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
                                                                           (anActiveWidget);
-  return !aWidgetValidated || aWidgetValidated->isValid(theOwner);
+  ModuleBase_ViewerPrs aPrs;
+  myWorkshop->selection()->fillPresentation(aPrs, theOwner);
+
+  return !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
 }