mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0026324: Visualization - fix iteration through corrupted memory in AIS_LocalContext::FindSelectedOwnerFromShape
The signature of SelectMgr_ViewerSelector::ActiveOwners is changed to return output parameter to avoid crash
This commit is contained in:
parent
c3ec36b69f
commit
751955d4d7
@ -1454,8 +1454,10 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const
|
||||
Standard_Boolean found(Standard_False);
|
||||
|
||||
if (!found) {
|
||||
NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (myMainVS->ActiveOwners());
|
||||
for (; anOwnersIt.More(); anOwnersIt.Next()) {
|
||||
NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
|
||||
myMainVS->ActiveOwners (anActiveOwners);
|
||||
for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners); anOwnersIt.More(); anOwnersIt.Next())
|
||||
{
|
||||
EO = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
|
||||
if (!BROwnr.IsNull() && BROwnr->HasShape() && BROwnr->Shape() == sh) {
|
||||
|
@ -839,9 +839,8 @@ const Handle(SelectBasics_SensitiveEntity)& SelectMgr_ViewerSelector::DetectedEn
|
||||
// function : ActiveOwners
|
||||
// purpose : Returns the list of active entity owners
|
||||
//=======================================================================
|
||||
NCollection_List<Handle(SelectBasics_EntityOwner)> SelectMgr_ViewerSelector::ActiveOwners() const
|
||||
void SelectMgr_ViewerSelector::ActiveOwners (NCollection_List<Handle(SelectBasics_EntityOwner)>& theOwners) const
|
||||
{
|
||||
NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
|
||||
for (SelectMgr_MapOfObjectSensitivesIterator anIter (myMapOfObjectSensitives); anIter.More(); anIter.Next())
|
||||
{
|
||||
const NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet = anIter.Value();
|
||||
@ -850,10 +849,8 @@ NCollection_List<Handle(SelectBasics_EntityOwner)> SelectMgr_ViewerSelector::Act
|
||||
{
|
||||
if (anEntitySet->GetSensitiveById (anIdx)->IsActiveForSelection())
|
||||
{
|
||||
anActiveOwners.Append (anEntitySet->GetSensitiveById (anIdx)->BaseSensitive()->OwnerId());
|
||||
theOwners.Append (anEntitySet->GetSensitiveById (anIdx)->BaseSensitive()->OwnerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return anActiveOwners;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public:
|
||||
Standard_EXPORT TCollection_AsciiString Status (const Handle(SelectMgr_SelectableObject)& theSelectableObject) const;
|
||||
|
||||
//! Returns the list of active entity owners
|
||||
Standard_EXPORT NCollection_List<Handle(SelectBasics_EntityOwner)> ActiveOwners() const;
|
||||
Standard_EXPORT void ActiveOwners (NCollection_List<Handle(SelectBasics_EntityOwner)>& theOwners) const;
|
||||
|
||||
//! Adds new object to the map of selectable objects
|
||||
Standard_EXPORT void AddSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject);
|
||||
|
Loading…
x
Reference in New Issue
Block a user