
Fri, 04/28/2023 - 18:49
Forums:
Hello. I have solved an issue, but decided that project maintainers may be interested to know about it. I have followed example, managed to read STEP file and get its contents, in form of TopTools_HSequenceOfShape object. Now, I am displaying it in my 3D view(er)/AIS_InteractiveContext. and doing FitAll for nice view. This code gives me crash:
bool GlfwOcctView::displayShSequence( const Handle(TopTools_HSequenceOfShape)& shapes)
{
myContext->RemoveAll(false);
if (shapes.IsNull() || !shapes->Length())
return false;
for (int i = 1; i <= shapes->Length(); i++)
myContext->Display(new AIS_Shape(shapes->Value(i)), AIS_Shaded,0, false);
myContext->UpdateCurrentViewer();
myView->FitAll(true);
return true;
}
Crash persists if I remove call to myContext->UpdateCurrentViewer();
But this code works as expected:
bool GlfwOcctView::displayShSequence( const Handle(TopTools_HSequenceOfShape)& shapes)
{
myContext->RemoveAll(false);
if (shapes.IsNull() || !shapes->Length())
return false;
for (int i = 1; i <= shapes->Length(); i++)
myContext->Display(new AIS_Shape(shapes->Value(i)), AIS_Shaded,0, false);
//
myView->FitAll(false);
myContext->UpdateCurrentViewer();
return true;
}
I copied crash callstack for you:
KernelBase.dll!00007ffe19ffcb69() Unknown
vcruntime140.dll!00007ffe03556720() Unknown
TKV3d.dll!00007ffde1f6343b() Unknown
TKV3d.dll!00007ffde1f63620() Unknown
> glfwOpenCascade.exe!GlfwOcctView::displayShSequence(const opencascade::handle<TopTools_HSequenceOfShape> & shapes) Line 358 C++
glfwOpenCascade.exe!GlfwOcctView::processUI() Line 321 C++
glfwOpenCascade.exe!GlfwOcctView::mainloop() Line 251 C++
glfwOpenCascade.exe!GlfwOcctView::run() Line 138 C++
glfwOpenCascade.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 30 C++
It's solved, but I thought you may be interested to know about it