apply race condition fix
This commit is contained in:
@@ -180,7 +180,15 @@ public final class TerminalPane implements AutoCloseable {
|
|||||||
|
|
||||||
/** This pane's own content revision, bumped on every change (see {@link #refresh()}). */
|
/** This pane's own content revision, bumped on every change (see {@link #refresh()}). */
|
||||||
public long contentVersion() {
|
public long contentVersion() {
|
||||||
return contentVersion;
|
synchronized (terminal) {
|
||||||
|
return contentVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
long snapshotVersion() {
|
||||||
|
synchronized (terminal) {
|
||||||
|
return snapshotVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean kittyEnabled() {
|
public boolean kittyEnabled() {
|
||||||
|
|||||||
@@ -92,12 +92,13 @@ final class TerminalPaneNode extends Region {
|
|||||||
void renderFull(boolean active) {
|
void renderFull(boolean active) {
|
||||||
prepareGeometry();
|
prepareGeometry();
|
||||||
RenderStateSnapshot snapshot = pane.snapshotFull();
|
RenderStateSnapshot snapshot = pane.snapshotFull();
|
||||||
|
long renderedVersion = pane.snapshotVersion();
|
||||||
boolean withKitty = pane.kittyEnabled() && hasKittyGraphics();
|
boolean withKitty = pane.kittyEnabled() && hasKittyGraphics();
|
||||||
updateRowsFull(snapshot);
|
updateRowsFull(snapshot);
|
||||||
updateKittyGraphics(snapshot, withKitty);
|
updateKittyGraphics(snapshot, withKitty);
|
||||||
updateCursor(snapshot);
|
updateCursor(snapshot);
|
||||||
updateBorder(active);
|
updateBorder(active);
|
||||||
markDrawn();
|
markDrawn(renderedVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderIncremental(boolean active) {
|
void renderIncremental(boolean active) {
|
||||||
@@ -113,6 +114,7 @@ final class TerminalPaneNode extends Region {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderStateSnapshot snapshot = pane.snapshot();
|
RenderStateSnapshot snapshot = pane.snapshot();
|
||||||
|
long renderedVersion = pane.snapshotVersion();
|
||||||
int dirty = snapshot == null ? DIRTY_FULL : snapshot.dirty();
|
int dirty = snapshot == null ? DIRTY_FULL : snapshot.dirty();
|
||||||
if (dirty == DIRTY_FULL) {
|
if (dirty == DIRTY_FULL) {
|
||||||
updateChangedRows(snapshot, snapshot.renderRows());
|
updateChangedRows(snapshot, snapshot.renderRows());
|
||||||
@@ -122,7 +124,7 @@ final class TerminalPaneNode extends Region {
|
|||||||
updateKittyGraphics(snapshot, false);
|
updateKittyGraphics(snapshot, false);
|
||||||
updateCursor(snapshot);
|
updateCursor(snapshot);
|
||||||
updateBorder(active);
|
updateBorder(active);
|
||||||
markDrawn();
|
markDrawn(renderedVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean prepareGeometry() {
|
private boolean prepareGeometry() {
|
||||||
@@ -578,8 +580,8 @@ final class TerminalPaneNode extends Region {
|
|||||||
return new SourceRect(sourceX, sourceY, Math.min(sourceWidth, image.getWidth() - sourceX), Math.min(sourceHeight, image.getHeight() - sourceY));
|
return new SourceRect(sourceX, sourceY, Math.min(sourceWidth, image.getWidth() - sourceX), Math.min(sourceHeight, image.getHeight() - sourceY));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markDrawn() {
|
private void markDrawn(long renderedVersion) {
|
||||||
drawnContentVersion = pane.contentVersion();
|
drawnContentVersion = renderedVersion;
|
||||||
drawnWidth = pane.width();
|
drawnWidth = pane.width();
|
||||||
drawnHeight = pane.height();
|
drawnHeight = pane.height();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user