Skip to content

Commit

Permalink
Refactor destructor to handle dynamic memory deletion
Browse files Browse the repository at this point in the history
- Updated the destructor in BaseItemManyWidgets class to properly delete dynamically allocated memory for widgets array.
  • Loading branch information
forntoh committed Oct 21, 2024
1 parent 7e4d39b commit 7eafa3c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/BaseItemManyWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class BaseItemManyWidgets : public MenuItem {
}
}

virtual ~BaseItemManyWidgets() {
for (uint8_t i = 0; i < size; ++i)
delete widgets[i];
delete[] widgets;
}

protected:
virtual void handleCommit() = 0;
/**
Expand Down

0 comments on commit 7eafa3c

Please sign in to comment.