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

Solve #16375 #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions TestData.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "TestData.h"
#include "a_member.h"

#include <TBuffer.h>

ClassImp(TestData);

TestData::~TestData() { delete sm; }
Expand All @@ -12,3 +14,25 @@ TestData::TestData() { Init(); }
TestData::TestData(const TestData &other) = default;

double TestData::Mag() const { return sm->get().Mag(); }

//______________________________________________________________________________
void TestData::Streamer(TBuffer &R__b)
{
// Stream an object of class TestData.

if (R__b.IsReading()) {
UInt_t R__s, R__c;
Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v < 2) {
TObject::Streamer(R__b);
delete sm;
sm = nullptr;
R__b >> sm;
R__b.CheckByteCount(R__s, R__c, TestData::IsA());
} else {
R__b.ReadClassBuffer(TestData::Class(),this);
}
} else {
R__b.WriteClassBuffer(TestData::Class(),this);
}
}
2 changes: 1 addition & 1 deletion TestData.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ class TestData : public TObject {
void Init();
a_member *sm;

ClassDef(TestData, 1)
ClassDefOverride(TestData, 2)
};
2 changes: 1 addition & 1 deletion TestDataLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// the missing "+" in TestData is
// the key to the problem
#pragma link C++ class TestData;
#pragma link C++ class TestData-;
#pragma link C++ class a_member+;

#endif
4 changes: 2 additions & 2 deletions a_member.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class a_member : public TObject {
[[nodiscard]] const TLorentzVector& get() const;

private:
ClassDef(a_member, 1)
};
ClassDefOverride(a_member, 1)
};
3 changes: 2 additions & 1 deletion read_old.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ int main() {
tree->GetEntry(i);
}
file.Close();
delete data;
return 0;
}
}