Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[macOS] Delay when closing dialog

Đang mở
#3,718 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, macos
Lĩnh vực
desktop, desktop-dev

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

  • 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();
Ngôn ngữ chính
Java
Star
202
Fork
206
Merge trung bình
21 giờ 55 phút
Pull request đã merge (30 ngày)
110

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-platform/eclipse.platform.swt

Tất cả issue của eclipse-platform/eclipse.platform.swt

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.