Skip to main content



      Home
Home » Eclipse Projects » NatTable » TextCellEditor causes a "SWT Resource was not properly disposed"
TextCellEditor causes a "SWT Resource was not properly disposed" [message #1854865] Thu, 15 September 2022 07:29 Go to next message
Eclipse UserFriend
I am currently using NatTable V. 2.0.1.
From the 2.0.2 and 2.0.3 changelogs, I could not see that this problem has been solved.

In Eclipse 4.19 (2021-03) an "API for Resource disposal tracking" was added to SWT, see https://www.eclipse.org/eclipse/news/4.19/platform_isv.php#resource-disposal-tracking

Whenever I run my NatTable instances, I get this exception:

java.lang.Error: SWT Resource was not properly disposed
	at org.eclipse.swt.graphics.Resource.initNonDisposeTracking(Resource.java:172)
	at org.eclipse.swt.graphics.Resource.<init>(Resource.java:120)
	at org.eclipse.swt.graphics.Cursor.<init>(Cursor.java:119)
	at org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor.createEditorControl(TextCellEditor.java:355)
	at org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor.createEditorControl(TextCellEditor.java:332)
	at org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor.activateCell(TextCellEditor.java:248)
	at org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor.activateCell(AbstractCellEditor.java:169)
	at org.eclipse.nebula.widgets.nattable.edit.EditController.editCell(EditController.java:104)
	at org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommandHandler.doCommand(EditCellCommandHandler.java:51)
	at org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommandHandler.doCommand(EditCellCommandHandler.java:1)
	at org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler.doCommand(AbstractLayerCommandHandler.java:22)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.doCommand(AbstractLayer.java:186)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.doCommand(CompositeLayer.java:134)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommand(GridLayer.java:194)
	at org.eclipse.nebula.widgets.nattable.NatTable.doCommand(NatTable.java:827)
	at org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction.run(MouseEditAction.java:33)
	at org.eclipse.nebula.widgets.nattable.ui.mode.MouseModeEventHandler.executeClickAction(MouseModeEventHandler.java:194)
	at org.eclipse.nebula.widgets.nattable.ui.mode.MouseModeEventHandler.mouseUp(MouseModeEventHandler.java:94)
	at org.eclipse.nebula.widgets.nattable.ui.mode.ModeSupport.mouseUp(ModeSupport.java:117)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:224)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4243)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4060)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3632)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)


When I look at the TextCellEditor.createEditorControl(), I see this line:

textControl.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM));


It would look like this Cursor instance needs to be disposed by calling Cursor.destroy() when disposing the Text widget.
Re: TextCellEditor causes a "SWT Resource was not properly disposed" [message #1854866 is a reply to message #1854865] Thu, 15 September 2022 10:00 Go to previous messageGo to next message
Eclipse UserFriend
With a closer look in the changelog you should find that this was solved in 2.0.3

https://bugs.eclipse.org/bugs/show_bug.cgi?id=580447
Re: TextCellEditor causes a "SWT Resource was not properly disposed" [message #1854867 is a reply to message #1854866] Thu, 15 September 2022 14:30 Go to previous messageGo to next message
Eclipse UserFriend
I am sorry that I did not see it in the 2.0.3 changelog.
Thanks for answering.
Re: TextCellEditor causes a "SWT Resource was not properly disposed" [message #1854870 is a reply to message #1854867] Thu, 15 September 2022 16:13 Go to previous message
Eclipse UserFriend
No issue, thanks for reporting the issue. Better twice than not at all.
Previous Topic:How to add a button to a table cell
Next Topic:Fill down function
Goto Forum:
  


Current Time: Thu May 15 19:51:10 EDT 2025

Powered by FUDForum. Page generated in 0.03047 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top