Skip to content

[C++] Global recording no longer reachable on current when going out of scope #5077

@Wumpf

Description

@Wumpf
#include <rerun.hpp>

int main() {
    const auto rec = rerun::RecordingStream("rerun_example_0");
    rec.connect().exit_on_failure();

    {
        const auto rec2 = rerun::RecordingStream("rerun_example_1");
        rec2.connect().exit_on_failure();
        rec2.set_global();
    }

    rec.log("recording0", rerun::Points3D({{0.0f, 0.0f, 0.0f}}));
    rerun::RecordingStream::current().log("recording1", rerun::Points3D({{0.0f, 0.0f, 0.0f}}));
}

this will only log to the first recording. This isn't what we documented on set_global:

        /// Replaces the currently active recording for this stream's store kind in the global scope
        /// with this one.
        ///
        /// Afterwards, destroying this recording stream will *not* change the global recording
        /// stream, as it increases an internal ref-count.
        void set_global() const;

TODO: Does this also affect Rust?

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdk-cppC/C++ API specificuser-requestThis is a pressing issue for one of our users🪳 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions