[api] Use custom deleter to fix incomplete-type error on macOS libc++ (#16050)

This commit is contained in:
J. Nick Koston
2026-04-28 21:26:21 -04:00
committed by GitHub
parent 1a57d9bc2f
commit 8af499b591
2 changed files with 13 additions and 2 deletions
+5
View File
@@ -30,6 +30,11 @@ APIServer *global_api_server = nullptr; // NOLINT(cppcoreguidelines-avoid-non-c
APIServer::APIServer() { global_api_server = this; }
// Custom deleter defined here so `delete` sees the complete APIConnection type.
// This prevents libc++ from emitting an "incomplete type" error when other
// translation units only have the forward declaration of APIConnection.
void APIServer::APIConnectionDeleter::operator()(APIConnection *p) const { delete p; }
void APIServer::socket_failed_(const LogString *msg) {
ESP_LOGW(TAG, "Socket %s: errno %d", LOG_STR_ARG(msg), errno);
this->destroy_socket_();