Skip to content

Make WiFiManagerParameter destructor virtual - #1692

Open
rguca wants to merge 1 commit into
tzapu:masterfrom
rguca:wifi-param-destructor
Open

Make WiFiManagerParameter destructor virtual#1692
rguca wants to merge 1 commit into
tzapu:masterfrom
rguca:wifi-param-destructor

Conversation

@rguca

@rguca rguca commented Dec 28, 2023

Copy link
Copy Markdown

If a instance of WiFiManagerParameter is created by new and deleted by delete, a compiler warning is issued.

src/settings/SettingsController.cpp:78:67: warning: deleting object of polymorphic class type 'WiFiManagerParameter' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
   78 |   for (WiFiManagerParameter* p : this->wifi_settings->parameters) delete p;

The destructor should be virtual, because the class can be extended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant