Skip to content

Commit 4ae32a0

Browse files
aljalinev
authored andcommitted
Fix memory leak in REveDataCollection::ClearItems()
1 parent f81ad8f commit 4ae32a0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

graf3d/eve7/inc/ROOT/REveDataCollection.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public:
132132

133133
void ReserveItems(Int_t items_size) { fItemList->fItems.reserve(items_size); }
134134
void AddItem(void *data_ptr, const std::string& n, const std::string& t);
135-
void ClearItems() { fItemList->fItems.clear(); }
135+
void ClearItems();
136136

137137
Bool_t SingleRnrState() const override { return kTRUE; }
138138
Bool_t SetRnrState(Bool_t) override;

graf3d/eve7/src/REveDataCollection.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,3 +453,10 @@ Int_t REveDataCollection::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
453453
return ret;
454454
}
455455

456+
void REveDataCollection::ClearItems()
457+
{
458+
for (size_t i = 0; i < fItemList->fItems.size(); ++i) {
459+
delete fItemList->fItems[i];
460+
}
461+
fItemList->fItems.clear();
462+
}

0 commit comments

Comments
 (0)