]> git.tdb.fi Git - libs/net.git/commitdiff
Don't create the WinSock helper until the first socket is created
authorMikko Rasa <tdb@tdb.fi>
Sun, 11 Dec 2022 11:14:57 +0000 (13:14 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 11 Dec 2022 16:26:44 +0000 (18:26 +0200)
source/net/windows/socket.cpp

index 07db95d1f7dd928ab357d645754a05d4b899a6b4..eadc22af3a2de5355c349d16e201f8d1ec01b032 100644 (file)
@@ -27,7 +27,7 @@ public:
        }
 };
 
-WinSockHelper wsh;
+unique_ptr<WinSockHelper> wsh;
 
 }
 
@@ -37,6 +37,8 @@ namespace Net {
 
 void Socket::platform_init()
 {
+       if(!wsh)
+               wsh = make_unique<WinSockHelper>();
        *priv->event = CreateEvent(0, false, false, 0);
 }