Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for segfault iss #1795 #1847

Merged
merged 19 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,12 @@ interactor_impl::interactor_impl(options& options, window_impl& window, scene_im
}

//----------------------------------------------------------------------------
interactor_impl::~interactor_impl() = default;
interactor_impl::~interactor_impl()
{
vtkOutputWindow::GetInstance()->RemoveObservers(vtkF3DConsoleOutputWindow::TriggerEvent);
vtkOutputWindow::GetInstance()->RemoveObservers(vtkF3DConsoleOutputWindow::ShowEvent);
vtkOutputWindow::GetInstance()->RemoveObservers(vtkF3DConsoleOutputWindow::HideEvent);
}

//----------------------------------------------------------------------------
interactor& interactor_impl::initCommands()
Expand Down
6 changes: 6 additions & 0 deletions library/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20230426)
)
endif()

if (VTK_VERSION VERSION_GREATER 9.2.6)
list(APPEND libf3dSDKTests_list
TestSDKEngineRecreation.cxx
)
endif()

# Invalid scene codepath needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11287
# Merge with TestSDKScene.cxx when VTK 9.4.0 is required.
if(VTK_VERSION VERSION_GREATER_EQUAL 9.3.20240707)
Expand Down
16 changes: 16 additions & 0 deletions library/testing/TestSDKEngineRecreation.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <engine.h>
#include <interactor.h>

int TestSDKEngineRecreation(int argc, char* argv[])
{
std::string filename = "TestSDKEngineRecreation";
std::string interactionFilePath = std::string(argv[1]) + "/recordings/" + filename + ".log";
auto eng = std::make_unique<f3d::engine>(f3d::engine::create(false));
eng = nullptr;
for (int i = 0; i < 5; i++)
{
auto eng2 = std::make_unique<f3d::engine>(f3d::engine::create(false));
eng2->getInteractor().playInteraction(interactionFilePath);
}
return EXIT_SUCCESS;
}
17 changes: 17 additions & 0 deletions testing/recordings/TestSDKEngineRecreation.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# StreamVersion 1.2
ExposeEvent 0 599 0 0 0 0 0
RenderEvent 0 599 0 0 0 0 0
TimerEvent 0 599 0 0 0 0 0
KeyPressEvent 103 471 0 27 1 Escape 0
CharEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
KeyReleaseEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
KeyPressEvent 103 471 0 27 1 Escape 0
CharEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
KeyReleaseEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
TimerEvent 103 471 0 27 1 Escape 0
Loading