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 12 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 @@ -565,7 +565,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
3 changes: 3 additions & 0 deletions library/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if(F3D_MODULE_UI)
TestSDKDynamicBackgroundColor.cxx
TestSDKDynamicFontFile.cxx
TestSDKDynamicProperties.cxx
TestSDKEngineRecreation.cxx
TestSDKInteractorCallBack.cxx
TestSDKInteractorDocumentation.cxx
TestSDKMultiOptions.cxx
Expand Down Expand Up @@ -62,6 +63,8 @@ configure_file("${F3D_SOURCE_DIR}/testing/recordings/TestSDKInteractorCallBack.l
"${CMAKE_BINARY_DIR}/TestSDKInteractorCallBack.log") # Dragon.vtu; S
configure_file("${F3D_SOURCE_DIR}/testing/recordings/TestSDKInteractorDropFullScene.log.in"
"${CMAKE_BINARY_DIR}/TestSDKInteractorDropFullScene.log") # world.obj; S
configure_file("${F3D_SOURCE_DIR}/testing/recordings/TestSDKEngineRecreation.log.in"
hant-hub marked this conversation as resolved.
Show resolved Hide resolved
"${CMAKE_BINARY_DIR}/TestSDKEngineRecreation.log") # world.obj; S

# External window tests
option(F3D_TESTING_ENABLE_EXTERNAL_GLFW "Test external GLFW" OFF)
Expand Down
24 changes: 24 additions & 0 deletions library/testing/TestSDKEngineRecreation.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <engine.h>
#include <interactor.h>
#include <log.h>
#include <options.h>
#include <scene.h>
#include <window.h>
hant-hub marked this conversation as resolved.
Show resolved Hide resolved

#include <iostream>

int TestSDKEngineRecreation(int argc, char* argv[])
{
std::string filename = "TestSDKEngineRecreation";
std::string interactionFilePath = std::string(argv[2]) + "../../" + filename + ".log";
f3d::engine* eng = new f3d::engine(f3d::engine::create(false));
eng->getInteractor().start(1 / 30, [eng]() { eng->getInteractor().stop(); });
delete eng;
for (int i = 0; i < 5; i++)
{
f3d::engine* eng2 = new f3d::engine(f3d::engine::create(false));
eng2->getInteractor().playInteraction(interactionFilePath);
delete eng2;
}
hant-hub marked this conversation as resolved.
Show resolved Hide resolved
return EXIT_SUCCESS;
}
17 changes: 17 additions & 0 deletions testing/recordings/TestSDKEngineRecreation.log.in
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