From 14072000be23f253f9621229cb3310238f6e14ac Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 16 Jul 2024 15:41:31 +0200 Subject: [PATCH 1/2] [C++] Fix resetting time destroying recording stream --- crates/top/rerun_c/src/lib.rs | 2 +- rerun_cpp/tests/recording_stream.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/top/rerun_c/src/lib.rs b/crates/top/rerun_c/src/lib.rs index acd664b6e7bb..68b4872b41ba 100644 --- a/crates/top/rerun_c/src/lib.rs +++ b/crates/top/rerun_c/src/lib.rs @@ -614,7 +614,7 @@ pub extern "C" fn rr_recording_stream_disable_timeline( #[allow(unsafe_code)] #[no_mangle] pub extern "C" fn rr_recording_stream_reset_time(stream: CRecordingStream) { - if let Some(stream) = RECORDING_STREAMS.lock().remove(stream) { + if let Some(stream) = RECORDING_STREAMS.lock().get(stream) { stream.reset_time(); } } diff --git a/rerun_cpp/tests/recording_stream.cpp b/rerun_cpp/tests/recording_stream.cpp index c87b52b116fe..4b6149e8ed78 100644 --- a/rerun_cpp/tests/recording_stream.cpp +++ b/rerun_cpp/tests/recording_stream.cpp @@ -560,6 +560,10 @@ SCENARIO("RecordingStream can set time without errors", TEST_TAG) { SECTION("Resetting time does not log errors") { check_logged_error([&] { stream.reset_time(); }); } + SECTION("Can set time again after resetting time tim") { + check_logged_error([&] { stream.reset_time(); }); + check_logged_error([&] { stream.set_time_seconds("duration", 1.0f); }); + } SECTION("Disabling timeline does not log errors") { check_logged_error([&] { stream.disable_timeline("doesn't exist"); }); From 95725195a0433966421423568dd857bf8ec98234 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 16 Jul 2024 15:47:07 +0200 Subject: [PATCH 2/2] fix typo --- rerun_cpp/tests/recording_stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rerun_cpp/tests/recording_stream.cpp b/rerun_cpp/tests/recording_stream.cpp index 4b6149e8ed78..3029128ce02c 100644 --- a/rerun_cpp/tests/recording_stream.cpp +++ b/rerun_cpp/tests/recording_stream.cpp @@ -560,7 +560,7 @@ SCENARIO("RecordingStream can set time without errors", TEST_TAG) { SECTION("Resetting time does not log errors") { check_logged_error([&] { stream.reset_time(); }); } - SECTION("Can set time again after resetting time tim") { + SECTION("Can set time again after resetting the time") { check_logged_error([&] { stream.reset_time(); }); check_logged_error([&] { stream.set_time_seconds("duration", 1.0f); }); }