Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346860 - SWT dispose exception with <if><then> constraint
Summary: SWT dispose exception with <if><then> constraint
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 07:54 EDT by Naga CLA
Modified: 2021-11-19 09:21 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Naga CLA 2011-05-23 07:54:11 EDT
SWT dispose exception with <if><then> constraint 

org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.SWT.error(SWT.java:3969)
at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
at org.eclipse.swt.widgets.Combo.getItemCount(Combo.java:690)
at org.eclipse.sapphire.ui.internal.binding.ComboBinding.removeMalformedItem(ComboBinding.java:103)
at org.eclipse.sapphire.ui.internal.binding.AbstractEnumBinding.doUpdateModel(AbstractEnumBinding.java:75)
at org.eclipse.sapphire.ui.internal.binding.AbstractBinding.updateModel(AbstractBinding.java:105)
at org.eclipse.sapphire.ui.internal.binding.ComboBinding$1.widgetSelected(ComboBinding.java:64)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


Sdef File Content:
==================
<if>				
<condition>
<class>ColumnScaleCondition</class>
</condition>						                <then>						                
<property-editor>prop1</property-editor>
<property-editor>
		<property>prop2</property>
		<hint>
			<name>prefer.combo</name>
			<value>true</value>
		</hint>
	</property-editor>
</then>
</if>

ColumnScaleCondition Class:
===========================
public final class ColumnScaleCondition

extends SapphireModelCondition

{
@Override
public boolean evaluate()
{

		
return true;

}

//@Override
public List<String> getDependencies()
{
    return Collections.singletonList( ITst.PROP_ITEM1.getName() );
}

}
Comment 1 Konstantin Komissarchik CLA 2011-05-23 23:37:39 EDT
Do you observe any other adverse effects besides the exception in the log?
Comment 2 Konstantin Komissarchik CLA 2011-05-23 23:40:07 EDT
Note that this bug is likely exposed by the specific combination of using a property listener to clear values of properties that are simultaneously being hidden by if/else construct. 

A temporary workaround would be to disable clearing of properties.
Comment 3 Naga CLA 2011-05-24 05:29:16 EDT
I removed the listeners, still getting the exception.

I think, in the boolean evaluate function, I am accessing the values to return true or false. That might be the reason I guess.

@Override
public boolean evaluate()
{
....
return true;

}
Comment 4 Konstantin Komissarchik CLA 2011-06-06 14:05:55 EDT
I reproduced and fixed this issue. I have added demonstration of the if-then-else construct use to the gallery sample as part of the fix.

Please verify the fix.
Comment 5 Konstantin Komissarchik CLA 2011-06-09 16:41:43 EDT
This can be verified via the gallery sample.
Comment 6 Ling Hao CLA 2011-06-09 16:51:06 EDT
Verified in sapphire-gallery.xml