Skip to content

Commit 6a36fec

Browse files
committed
LibProxy: Fix compile error from "-Wexit-time-destructors" flag
1 parent 740b37e commit 6a36fec

5 files changed

Lines changed: 5 additions & 7 deletions

File tree

Libraries/LibCore/Forward.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class UDPServer;
4747
class UDPSocket;
4848
class WeakEventLoopReference;
4949

50-
struct ProxyData;
51-
5250
#ifdef AK_OS_MACH
5351
class MachPort;
5452
#endif

Libraries/LibProxy/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ set(SOURCES
33
ProxyManager.cpp
44
Platform/ProxyPlatform.cpp
55
Platform/ProxyEnv.cpp
6-
Platform/ProxyEnv.cpp
76
)
87

98
if (APPLE)

Libraries/LibProxy/Proxy.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "Proxy.h"
88
#include "Platform/ProxyPlatform.h"
99
#include "ProxyManager.h"
10+
#include <AK/Atomic.h>
1011
#include <AK/String.h>
1112
#include <AK/StringUtils.h>
1213
#include <AK/StringView.h>

Libraries/LibProxy/ProxyManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
*/
66

77
#include "ProxyManager.h"
8+
#include <AK/NeverDestroyed.h>
9+
#include <LibSync/Once.h>
810

911
namespace Proxy {
1012

1113
ProxyManager* ProxyManager::s_the = nullptr;
12-
Sync::OnceFlag ProxyManager::s_once {};
1314

1415
ProxyManager::ProxyManager()
1516
{
@@ -20,7 +21,8 @@ ProxyManager::ProxyManager()
2021

2122
ProxyManager& ProxyManager::the()
2223
{
23-
Sync::call_once(s_once, [] {
24+
static NeverDestroyed<Sync::OnceFlag> s_once;
25+
Sync::call_once(*s_once, [] {
2426
s_the = new ProxyManager();
2527
});
2628
return *s_the;

Libraries/LibProxy/ProxyManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <AK/NonnullRefPtr.h>
1313
#include <AK/RefPtr.h>
1414
#include <LibSync/Mutex.h>
15-
#include <LibSync/Once.h>
1615

1716
namespace Proxy {
1817

@@ -28,7 +27,6 @@ class ProxyManager {
2827

2928
private:
3029
static ProxyManager* s_the;
31-
static Sync::OnceFlag s_once;
3230

3331
Sync::Mutex m_proxy_table_lock;
3432
AK::RefPtr<SystemProxyTable> m_proxy_tables;

0 commit comments

Comments
 (0)