Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[macOS] Delay when closing dialog

Aperta
#3,718 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, macos

Direzione di ricerca

The payload contains only the reproduction snippet, with no source files named. Start by running the snippet on macOS, then find where Display.readAndDispatch() and the Cocoa event loop handle closing a dialog. The bug is confirmed when the dialog stays open during Thread.sleep(4000), and the fix is done when it closes immediately as it does on Windows and Linux.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

  • All versions of SWT and JFace
  • macOS 15, 26 or 27
  • Java 25 Temurin
  • This problem has always existed

There can be a delay when closing a Dialog (JFace or SWT) on Mac if it's followed by a long running task. This delay does not occur on Windows or Linux where the dialog is closed immediately.

Run the Snippet. On Windows or Linux the dialog or message box closes immediately. On Mac the dialog only closes when the long running task completes.

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

public class DialogCloseDelay {

    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
        shell.setText("Dialog Test");
        shell.setLayout(new FillLayout());
        shell.setSize(450, 250);
        shell.open();

        // Same behavior on JFace Dialog or SWT Dialog (MessageBox)
        boolean useDialog = true;
        if(useDialog) {
            Dialog dialog = new Dialog(shell) {};
            dialog.open();
        }
        else {
            MessageBox box = new MessageBox(shell);
            box.open();
        }
        
        // Uncomment this to unfreeze it
        // shell.getDisplay().readAndDispatch();

        // Long running task
        try {
            Thread.sleep(4000);
        }
        catch(InterruptedException e) {}

        while(!shell.isDisposed()) {
            if(!display.readAndDispatch()) {
                display.sleep();
            }
        }
        
        display.dispose();
    }
}

If the following line in the Snippet is uncommented there is no freeze:

shell.getDisplay().readAndDispatch();
Lingua principale
Java
Stelle
202
Fork
206
Merge medio
14h 7m
PR unite (30g)
103

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di eclipse-platform/eclipse.platform.swt

Tutte le issue di eclipse-platform/eclipse.platform.swt

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.