File tree 1 file changed +11
-7
lines changed
src/main/java/org/fusesource/jansi
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -228,9 +228,9 @@ public static int getTerminalWidth() {
228
228
}
229
229
}
230
230
231
- private static boolean initialized ;
232
- private static int installed ;
233
- private static int virtualProcessing ;
231
+ private static boolean initialized ; // synchronized on AnsiConsole.class
232
+ private static int installed ; // synchronized on AnsiConsole.class
233
+ private static int virtualProcessing ; // synchronized on AnsiConsole.class
234
234
235
235
private AnsiConsole () {}
236
236
@@ -295,12 +295,16 @@ public int getTerminalWidth() {
295
295
processor = null ;
296
296
type = AnsiType .VirtualTerminal ;
297
297
installer = () -> {
298
- virtualProcessing ++;
299
- SetConsoleMode (console , mode [0 ] | ENABLE_VIRTUAL_TERMINAL_PROCESSING );
298
+ synchronized (AnsiConsole .class ) {
299
+ virtualProcessing ++;
300
+ SetConsoleMode (console , mode [0 ] | ENABLE_VIRTUAL_TERMINAL_PROCESSING );
301
+ }
300
302
};
301
303
uninstaller = () -> {
302
- if (--virtualProcessing == 0 ) {
303
- SetConsoleMode (console , mode [0 ]);
304
+ synchronized (AnsiConsole .class ) {
305
+ if (--virtualProcessing == 0 ) {
306
+ SetConsoleMode (console , mode [0 ]);
307
+ }
304
308
}
305
309
};
306
310
width = kernel32Width ;
You can’t perform that action at this time.
0 commit comments