Partial revert of "Fix nullptr dereference bug in TList::RecursiveRem…#961
Closed
pcanal wants to merge 1 commit intoroot-project:masterfrom
Closed
Partial revert of "Fix nullptr dereference bug in TList::RecursiveRem…#961pcanal wants to merge 1 commit intoroot-project:masterfrom
pcanal wants to merge 1 commit intoroot-project:masterfrom
Conversation
…ove()" This partially revert commit 71b778c We can not use (directly) a for loop in RecursiveRemove as its deletes the object/iterator inside the loop: for (TObjLink *lnk = fFirst; lnk; lnk = lnk->Next()) { ... DeleteLink(lnk); } Resulting in : Processing tutorials/graphs/multipalette.C... (TCanvas *) 0x12fd08e0 ==7117== Invalid read of size 8 ==7117== at 0x5111612: TObjLink::Next() (TList.h:142) ==7117== by 0x51B74F4: TList::RecursiveRemove(TObject*) (TList.cxx:713) ==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143) ==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722) ==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143) ==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722) ==7117== by 0x51B96CB: THashList::RecursiveRemove(TObject*) (THashList.cxx:286) ==7117== by 0x514245A: TObject::~TObject() (TObject.cxx:88) ==7117== by 0x50EDC1D: TNamed::~TNamed() (TNamed.h:41) ==7117== by 0x14535B0F: TF1::~TF1() (TF1.cxx:827) ==7117== by 0x1454CA07: TF2::~TF2() (TF2.cxx:153) ==7117== by 0x1454CA3D: TF2::~TF2() (TF2.cxx:155) ==7117== by 0x51B09D4: TCollection::GarbageCollect(TObject*) (TCollection.cxx:748) ==7117== by 0x51B6BE8: TList::Delete(char const*) (TList.cxx:501) ==7117== by 0x518E05D: TROOT::EndOfProcessCleanups() (TROOT.cxx:1171) ==7117== by 0x524F659: TUnixSystem::Exit(int, bool) (TUnixSystem.cxx:2153) ==7117== by 0x5169BE1: TApplication::Terminate(int) (TApplication.cxx:1279) ==7117== by 0x4049925: TRint::Terminate(int) (TRint.cxx:686) ==7117== by 0x40486D5: TRint::Run(bool) (TRint.cxx:437) ==7117== by 0x4012AA: main (rmain.cxx:30) ==7117== Address 0x6e72ff8 is 8 bytes inside a block of size 56 free'd ==7117== at 0x4C2918D: operator delete(void*) (vg_replace_malloc.c:576) ==7117== by 0x51B8B11: TObjOptLink::~TObjOptLink() (TList.h:163) ==7117== by 0x51B6DAF: TList::DeleteLink(TObjLink*) (TList.cxx:530) ==7117== by 0x51B74C0: TList::RecursiveRemove(TObject*) (TList.cxx:742) ==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143) ==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722) ==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143) ==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722) ==7117== by 0x51B96CB: THashList::RecursiveRemove(TObject*) (THashList.cxx:286) ==7117== by 0x514245A: TObject::~TObject() (TObject.cxx:88) ==7117== by 0x50EDC1D: TNamed::~TNamed() (TNamed.h:41) ==7117== by 0x14535B0F: TF1::~TF1() (TF1.cxx:827) ==7117== by 0x1454CA07: TF2::~TF2() (TF2.cxx:153) ==7117== by 0x1454CA3D: TF2::~TF2() (TF2.cxx:155)
|
Starting build on |
Member
|
I reverted the old change and applied my original one liner to fix the bug instead. Thanks for spotting the problem. |
This was referenced Sep 3, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ove()"
This partially revert commit 71b778c
We can not use (directly) a for loop in RecursiveRemove as its deletes
the object/iterator inside the loop:
for (TObjLink *lnk = fFirst; lnk; lnk = lnk->Next()) {
...
DeleteLink(lnk);
}
Resulting in :
Processing tutorials/graphs/multipalette.C...
(TCanvas ) 0x12fd08e0
==7117== Invalid read of size 8
==7117== at 0x5111612: TObjLink::Next() (TList.h:142)
==7117== by 0x51B74F4: TList::RecursiveRemove(TObject) (TList.cxx:713)
==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143)
==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722)
==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143)
==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722)
==7117== by 0x51B96CB: THashList::RecursiveRemove(TObject*) (THashList.cxx:286)
==7117== by 0x514245A: TObject::~TObject() (TObject.cxx:88)
==7117== by 0x50EDC1D: TNamed::~TNamed() (TNamed.h:41)
==7117== by 0x14535B0F: TF1::~TF1() (TF1.cxx:827)
==7117== by 0x1454CA07: TF2::~TF2() (TF2.cxx:153)
==7117== by 0x1454CA3D: TF2::~TF2() (TF2.cxx:155)
==7117== by 0x51B09D4: TCollection::GarbageCollect(TObject*) (TCollection.cxx:748)
==7117== by 0x51B6BE8: TList::Delete(char const*) (TList.cxx:501)
==7117== by 0x518E05D: TROOT::EndOfProcessCleanups() (TROOT.cxx:1171)
==7117== by 0x524F659: TUnixSystem::Exit(int, bool) (TUnixSystem.cxx:2153)
==7117== by 0x5169BE1: TApplication::Terminate(int) (TApplication.cxx:1279)
==7117== by 0x4049925: TRint::Terminate(int) (TRint.cxx:686)
==7117== by 0x40486D5: TRint::Run(bool) (TRint.cxx:437)
==7117== by 0x4012AA: main (rmain.cxx:30)
==7117== Address 0x6e72ff8 is 8 bytes inside a block of size 56 free'd
==7117== at 0x4C2918D: operator delete(void*) (vg_replace_malloc.c:576)
==7117== by 0x51B8B11: TObjOptLink::~TObjOptLink() (TList.h:163)
==7117== by 0x51B6DAF: TList::DeleteLink(TObjLink*) (TList.cxx:530)
==7117== by 0x51B74C0: TList::RecursiveRemove(TObject*) (TList.cxx:742)
==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143)
==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722)
==7117== by 0x4164444: TPad::RecursiveRemove(TObject*) (TPad.cxx:5143)
==7117== by 0x51B73B7: TList::RecursiveRemove(TObject*) (TList.cxx:722)
==7117== by 0x51B96CB: THashList::RecursiveRemove(TObject*) (THashList.cxx:286)
==7117== by 0x514245A: TObject::~TObject() (TObject.cxx:88)
==7117== by 0x50EDC1D: TNamed::~TNamed() (TNamed.h:41)
==7117== by 0x14535B0F: TF1::~TF1() (TF1.cxx:827)
==7117== by 0x1454CA07: TF2::~TF2() (TF2.cxx:153)
==7117== by 0x1454CA3D: TF2::~TF2() (TF2.cxx:155)