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

[GTK] problematic runtime behavior in table when deleting many rows

Đang mở
#3,607 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
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
frontend

Hướng nghiên cứu

Start by reproducing the hang with the supplied GTK3 Java snippet: create a multi-select virtual table, select a row that will be removed, then shrink its item count from 50,000 to 5. Compare the timing with only the first row selected and trace the GTK table item-count and selection-removal paths. Done means shrinking rows intersecting the selection is comparably fast and the behavior is covered by a regression test.

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

Mô tả

On GTK3, deleting many rows from a table results in a hang if

  • SWT_MULTI is set
  • the rows to be deleted intersect with the selection of the table
  • the number of rows to be deleted is relatively large

Snippet:

import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class GtkTablePerformanceIssue {
	private static final int HUGE_COUNT = 500_000;
	private static final int LARGE_COUNT = 50_000;
	private static final int SMALL_COUNT = 5;

	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setText("GTK Table remove performance");
		shell.setLayout(new GridLayout(1, false));

		final Table table = new Table(shell, SWT.VIRTUAL | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
		table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		table.addListener(SWT.SetData, event -> {
			final TableItem item = (TableItem)event.item;
			item.setText("Item " + table.indexOf(item));
		});

		final Label explanation = new Label(shell, SWT.NONE);
		explanation.setText("When shrinking, select a row which won't exist after the shrink.");

		final Button huge = new Button(shell, SWT.PUSH);
		huge.setText("Reset to " + HUGE_COUNT + " rows");
		huge.addListener(SWT.Selection, event -> table.setItemCount(HUGE_COUNT));

		final Button large = new Button(shell, SWT.PUSH);
		large.setText("Reset to " + LARGE_COUNT + " rows");
		large.addListener(SWT.Selection, event -> table.setItemCount(LARGE_COUNT));

		final Button shrink = new Button(shell, SWT.PUSH);
		shrink.setText("Shrink to " + SMALL_COUNT + " rows");
		final Label result = new Label(shell, SWT.NONE);
		result.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		shrink.addListener(SWT.Selection, event -> {
			final long start = System.nanoTime();
			table.setItemCount(SMALL_COUNT);
			final long elapsedMillis = (System.nanoTime() - start) / 1_000_000;
			result.setText("setItemCount(" + SMALL_COUNT + "): " + elapsedMillis + " ms");
			result.getParent().layout();
		});

		table.setItemCount(LARGE_COUNT);
		table.select(8);
		shell.setSize(500, 400);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}
}

Expected behavior
The entries should be removed as fast as they are when only the first row is selected.

Ngôn ngữ chính
Java
Star
202
Fork
206
Merge trung bình
14 giờ 7 phút
Pull request đã merge (30 ngày)
103

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.