Don't create CFSocket unnecessarily when closing wxSocket

DoClose() shouldn't do anything if CFSocket hadn't been created at all
(as will be the case for blocking sockets) instead of creating it only
to destroy it immediately afterwards.
This commit is contained in:
Vadim Zeitlin
2019-11-01 16:00:22 +01:00
parent ef224dbe41
commit 6bc30968c5

View File

@@ -63,6 +63,12 @@ public:
private:
virtual void DoClose() wxOVERRIDE
{
// No need to do anything if we had never created the underlying
// socket: this avoids creating it from Uninstall_Callback() completely
// unnecessarily.
if ( !m_socket )
return;
wxSocketManager * const manager = wxSocketManager::Get();
if ( manager )
{