Hi Andres,
as per ROOT’s historical ownership rules, a TTree created like that will belong to the current gDirectory. At teardown, both the unique_ptr and the gDirectory will delete the TTree, causing the crash.
There is an easy solution in v6.14 though, that was put in place exactly to avoid these kind of issues: you can tell the TTree to not register in any TDirectory, like this:
auto theTree = std::make_unique<TTree>("myTree","MyTestTree", /*splitlevel=*/99, /*dir=*/nullptr);