File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class WinWidth
2222
2323 static std::atomic<size_t > lastReset;
2424 static std::atomic<bool > isLegacyConsole;
25- static thread_local WinWidth localInstance;
25+ static thread_local WinWidth & localInstance;
2626
2727 std::unordered_map<uint32_t , short > results;
2828 HANDLE cnHandle {INVALID_HANDLE_VALUE};
@@ -33,6 +33,7 @@ class WinWidth
3333 void tearDown () noexcept ;
3434
3535 ~WinWidth ();
36+ struct Destructor ;
3637
3738public:
3839
Original file line number Diff line number Diff line change @@ -8,7 +8,17 @@ namespace tvision
88
99std::atomic<size_t > WinWidth::lastReset {0 };
1010std::atomic<bool > WinWidth::isLegacyConsole {false };
11- WinWidth thread_local WinWidth::localInstance;
11+ WinWidth thread_local &WinWidth::localInstance = *new WinWidth;
12+
13+ // MinGW: work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562
14+ // by deleting 'localInstance' through a static reference.
15+ struct WinWidth ::Destructor
16+ {
17+ ~Destructor ()
18+ {
19+ delete &localInstance;
20+ }
21+ } static thread_local destructor;
1222
1323WinWidth::~WinWidth ()
1424{
You can’t perform that action at this time.
0 commit comments