Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 568905

Summary: [macOS BigSur] Any listener for SWT.EraseItem breaks checkboxes and images
Product: [Eclipse Project] Platform Reporter: Ned Twigg <ned.twigg>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jeeeyul, lshanmug, twolf
Version: 4.17   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=565969
Whiteboard:
Bug Depends on:    
Bug Blocks: 565691    

Description Ned Twigg CLA 2020-11-17 17:58:42 EST
On MacOS BigSur 11.0.1, if you add any listener to SWT.EraseItem, then Tables will no longer render checkboxes or images correctly.

This was not true in 10.15 Catalina. I have confirmed this behavior with SWT 4.16 and 4.17. An example which reproduces this is below:

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

public class MacBigSurTable {
	public static void main(String[] args) {
		Display display = Display.getDefault();
		Shell underTest = new Shell(display, SWT.SHELL_TRIM);
		underTest.setLayout(new FillLayout());
		createTable(underTest, "works");
		Table brokenTable = createTable(underTest, "broken");
		brokenTable.addListener(SWT.EraseItem, e -> {
			// breaks the table even if it doesn't do anything at all
		});

		underTest.open();
		while (!underTest.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	private static Table createTable(Shell parent, String name) {
		Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
		group.setText(name);
		group.setLayout(new FillLayout());

		Table table = new Table(group, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
		TableItem item = new TableItem(table, SWT.NONE);
		item.setText("Test");
		return table;
	}
}
Comment 1 Ned Twigg CLA 2020-11-17 17:59:13 EST
I should add that this is the only BigSur bug I have seen, so great work SWT team!
Comment 2 Jeeeyul Lee CLA 2020-11-17 23:05:52 EST
It looks duplicated with #565969
Comment 3 Lakshmi P Shanmugam CLA 2020-11-18 05:22:33 EST

*** This bug has been marked as a duplicate of bug 565969 ***
Comment 4 Ned Twigg CLA 2020-12-23 17:21:42 EST
Confirmed fixed in 4.18, thanks!