Skip to content

Conversation

pcanal
Copy link
Member

@pcanal pcanal commented Sep 22, 2025

Fixes #19963

@pcanal pcanal requested a review from Copilot September 22, 2025 15:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a bug in TTree where previously read data from a deleted scratch area could be accessed incorrectly for associative containers. The fix involves preventing duplicate reads on associative containers when the same entry is accessed multiple times, and ensures proper reset of read entry cursors for sub-branches.

Key changes:

  • Added helper function to identify associative containers and prevent duplicate reads
  • Modified entry reading logic to handle associative containers specially
  • Added recursive reset functionality for sub-branch read cursors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

github-actions bot commented Sep 22, 2025

Test Results

    21 files      21 suites   3d 13h 46m 11s ⏱️
 3 681 tests  3 681 ✅ 0 💤 0 ❌
75 481 runs  75 481 ✅ 0 💤 0 ❌

Results for commit b1d4ac1.

♻️ This comment has been updated with latest results.

Fix one case that had not been updated to support multimap/multiset.
@pcanal pcanal force-pushed the tbranchelement-associative branch 3 times, most recently from 4a7fa82 to 89425f5 Compare September 24, 2025 20:55
@pcanal pcanal marked this pull request as ready for review September 24, 2025 20:56
@pcanal pcanal requested review from Copilot, jblomer and vepadulano and removed request for bellenot September 24, 2025 20:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pcanal pcanal force-pushed the tbranchelement-associative branch from 89425f5 to 37ead82 Compare September 25, 2025 01:15
@pcanal pcanal force-pushed the tbranchelement-associative branch from 37ead82 to 9d1ee9f Compare September 25, 2025 15:21
The flow for reading an STL associative container is:
  (a) Read branch count
  (b) load sub-branch data into a staging/temporary area
  (c) copy/insert that data into the associative container
Previously doing a direct read like:
  tree->GetBranch("map.second")->GetEntry(e);
was leading to 'write' into deleted memory.
This directly test the use pattern applied by TTree::Scan/Draw
This allow to document the 2 sets of similar test at the same place to contrast them
@dpiparo dpiparo merged commit 7e0fcc8 into root-project:master Sep 26, 2025
29 of 30 checks passed
@pcanal pcanal deleted the tbranchelement-associative branch September 26, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading individual TTree sub-branch into a std::map lead to write into delete memory.
3 participants