Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MinitraceLogger throws std::logic_error #38

Closed
@Thordreck

Description

@Thordreck

Hi,
I just noticed that the MinitraceLogger throws an exception complaining that only one instance is allowed, even if all the previous instances were deleted. I think the reference variable should be set to false in the destructor. From bt_minitrace_logger.cpp file (the exception message seems to be a bit off too):

MinitraceLogger::MinitraceLogger(TreeNode* root_node, const char* filename_json)
  : StatusChangeLogger(root_node)
{
    bool expected = false;
    if (!ref_count.compare_exchange_strong(expected, true))
    {
        throw std::logic_error("Only one instance of StdCoutLogger shall be created");
    }

    minitrace::mtr_register_sigint_handler();
    minitrace::mtr_init(filename_json);
    this->enableTransitionToIdle(true);
}

MinitraceLogger::~MinitraceLogger()
{
    minitrace::mtr_flush();
    minitrace::mtr_shutdown();
}

Cheers.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions