Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » SWTException Graphic is disposed on FieldDecoration image during tests
SWTException Graphic is disposed on FieldDecoration image during tests [message #479010] Sat, 08 August 2009 01:03 Go to next message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
I run UI tests in a custom JUnit runner that starts a Display for each test
class. This means that in a suite run, multiple Displays are created and
disposed. Until now, I have not run into any problems with this, mostly
because I use JFaceResources.getResources() for everything and it ties
resources to a particular display.

However, FieldDecorationRegistry caches actual Image objects in singleton
state the first time they are requested. This ties the images (and thus the
singleton FieldDecorationRegistry) forever to the current display. For me,
this means that after one test uses JFaceResources.getImageRegistry, the
registry is broken for the remainder of the JUnit run.

Is this intended behavior? Why cache the image in
FieldDecorationRegistry#Entry? The ImageRegistry already does that for you.

-Will
Re: SWTException Graphic is disposed on FieldDecoration image during tests [message #479013 is a reply to message #479010] Sat, 08 August 2009 02:15 Go to previous message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
Looking more carefully, even JFaceResources.getImageRegistry is a singleton
tied to one display. So it appears that JFace does not support multiple
displays in a given JVM.

"Will Horn" <will.horn@gmail.com> wrote in message
news:h5iisb$84t$1@build.eclipse.org...
>I run UI tests in a custom JUnit runner that starts a Display for each test
>class. This means that in a suite run, multiple Displays are created and
>disposed. Until now, I have not run into any problems with this, mostly
>because I use JFaceResources.getResources() for everything and it ties
>resources to a particular display.
>
> However, FieldDecorationRegistry caches actual Image objects in singleton
> state the first time they are requested. This ties the images (and thus
> the singleton FieldDecorationRegistry) forever to the current display.
> For me, this means that after one test uses
> JFaceResources.getImageRegistry, the registry is broken for the remainder
> of the JUnit run.
>
> Is this intended behavior? Why cache the image in
> FieldDecorationRegistry#Entry? The ImageRegistry already does that for
> you.
>
> -Will
Previous Topic:Preventing flip from a preference page
Next Topic:Performance of setItemCount in SWT Tree
Goto Forum:
  


Current Time: Thu Apr 25 06:52:40 GMT 2024

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

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

Back to the top