Skip to content

Commit 5ec5daf

Browse files
committed
fixup! JBR-9738 Wayland: crash in nativeHideFrame()
1 parent 321a2a8 commit 5ec5daf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,18 +368,22 @@ private boolean isPopupPositionUnconstrained() {
368368
protected void wlSetVisible(boolean v) {
369369
// TODO: this whole method should be moved to WLWindowPeer
370370
synchronized (getStateLock()) {
371-
if (this.visible == v) return;
372-
373-
if (v) {
374-
show();
371+
// TODO: make sure visibility state cannot be changed midway through this method
372+
if (visible == v) return;
373+
}
374+
if (v) {
375+
show();
376+
synchronized (getStateLock()) {
375377
// Consider the window visible only if show() fully succeeds.
376378
visible = true;
377-
} else {
379+
}
380+
} else {
381+
synchronized (getStateLock()) {
378382
// Hiding is presumed to succeed even if an error occurs in the process
379383
// in the sense that a subsequent request to hide() will not do anything useful.
380384
visible = false;
381-
hide();
382385
}
386+
hide();
383387
}
384388
}
385389

0 commit comments

Comments
 (0)