Commit 4097f1fe authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Also reset ObjectCount when reading in events

Otherwise TRefs will keep piling up and new event references will
point to objects from another event
parent 399de40f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -268,6 +268,9 @@ void ROOTObjectReaderModule::initialize() {
void ROOTObjectReaderModule::run(Event* event) {
    auto root_lock = root_process_lock();

    // Retrieve current object count:
    auto object_count = TProcessID::GetObjectCount();

    // Beware: ROOT uses signed entry counters for its trees
    auto event_num = static_cast<int64_t>(event->number);
    --event_num;
@@ -322,6 +325,10 @@ void ROOTObjectReaderModule::run(Event* event) {
        // Reset the message pointer:
        message_inf.message.reset();
    }

    // Reset the TObject count after reading in this event because the TRef counting will start over again from the beginning
    // in the next event.
    TProcessID::SetObjectCount(object_count);
}

void ROOTObjectReaderModule::finalize() {