Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13_0_X] fBits read: preserve kIsOnHeap, always set kNotDeleted. #201

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/base/src/TObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,9 @@ void TObject::Streamer(TBuffer &R__b)
if (R__b.IsReading()) {
R__b.SkipVersion(); // Version_t R__v = R__b.ReadVersion(); if (R__v) { }
R__b >> fUniqueID;
const UInt_t isonheap = fBits & kIsOnHeap; // Record how this instance was actually allocated.
R__b >> fBits;
fBits |= kIsOnHeap; // by definition de-serialized object is on heap
fBits |= isonheap | kNotDeleted; // by definition de-serialized object are not yet deleted.
if (TestBit(kIsReferenced)) {
//if the object is referenced, we must read its old address
//and store it in the ProcessID map in gROOT
Expand Down
2 changes: 2 additions & 0 deletions io/io/src/TStreamerInfoActions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ namespace TStreamerInfoActions
UInt_t *x = (UInt_t*)( ((char*)addr) + config->fOffset );
// Idea: Implement buf.ReadBasic/Primitive to avoid the return value
// Idea: This code really belongs inside TBuffer[File]
const UInt_t isonheap = *x & TObject::kIsOnHeap; // Record how this instance was actually allocated.
buf >> *x;
*x |= isonheap | TObject::kNotDeleted; // by definition de-serialized object are not yet deleted.

if ((*x & kIsReferenced) != 0) {
HandleReferencedTObject(buf,addr,config);
Expand Down
6 changes: 5 additions & 1 deletion io/io/src/TStreamerInfoReadBuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ Int_t TStreamerInfo::ReadBufferConv(TBuffer &b, const T &arr, const TCompInfo *
DOLOOP {
UInt_t u;
b >> u;
u |= kNotDeleted; // by definition de-serialized object are not yet deleted.
if ((u & kIsReferenced) != 0) {
UShort_t pidf;
b >> pidf;
Expand Down Expand Up @@ -1019,7 +1020,10 @@ Int_t TStreamerInfo::ReadBuffer(TBuffer &b, const T &arr,
// special case for TObject::fBits in case of a referenced object
case TStreamerInfo::kBits: {
DOLOOP {
UInt_t *x=(UInt_t*)(arr[k]+ioffset); b >> *x;
UInt_t *x=(UInt_t*)(arr[k]+ioffset);
const UInt_t isonheap = *x & TObject::kIsOnHeap; // Record how this instance was actually allocated.
b >> *x;
*x |= isonheap | TObject::kNotDeleted; // by definition de-serialized object are not yet deleted.
if ((*x & kIsReferenced) != 0) {
UShort_t pidf;
b >> pidf;
Expand Down