Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Disposing of items in the Gallery
Disposing of items in the Gallery [message #51672] Thu, 17 April 2008 23:45 Go to next message
Trevor Campbell is currently offline Trevor Campbell
Messages: 23
Registered: July 2009
Junior Member
I am using the Gallery to show a collection of Images and need to dispose
of the image resources when they are no longer needed.

I tried:
DisposeListener mImageDisposalListener = new DisposeListener()
{
@Override
public void widgetDisposed(DisposeEvent e)
{
GalleryItem item = (GalleryItem) e.widget;
item.getImage().dispose();
}

};
galleryItem.addDisposeListener(mImageDisposalListener);
but have found that the widgetDisposed event is not being fired when the
container is disposed of.

Is this a bug? or should I be trying to track and dispose of all the image
resources myself.
Re: Disposing of items in the Gallery [message #51969 is a reply to message #51672] Thu, 24 April 2008 02:54 Go to previous messageGo to next message
Nicolas Richeton is currently offline Nicolas Richeton
Messages: 179
Registered: July 2009
Senior Member
Hi Trevor,

Managing the images this way can lead to a large number of open handles,
but as long as you only display a reasonable number of image, it is ok.

In ShareMedia
( http://sourceforge.net/project/screenshots.php?group_id=1669 62&ssid=69060),
I can display a very large number of Image in a single Gallery so I only
keep a small subset in memory and Images are created on display (using
the paint event).

All SWT events are not yet implemented in Gallery. But if Table or Tree
has this behavior, please open a bug and I'll fix this asap.

--
Nicolas

Trevor Campbell a écrit :
> I am using the Gallery to show a collection of Images and need to
> dispose of the image resources when they are no longer needed.
>
> I tried:
> DisposeListener mImageDisposalListener = new DisposeListener()
> {
> @Override
> public void widgetDisposed(DisposeEvent e)
> {
> GalleryItem item = (GalleryItem) e.widget;
> item.getImage().dispose();
> }
>
> };
> galleryItem.addDisposeListener(mImageDisposalListener);
> but have found that the widgetDisposed event is not being fired when the
> container is disposed of.
>
> Is this a bug? or should I be trying to track and dispose of all the
> image resources myself.
>
Re: Disposing of items in the Gallery [message #52020 is a reply to message #51969] Thu, 24 April 2008 20:26 Go to previous message
Trevor Campbell is currently offline Trevor Campbell
Messages: 23
Registered: July 2009
Junior Member
Thanks Nicolas. I have raised bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=228798.

Regards
Trevor
Re: Disposing of items in the Gallery [message #589447 is a reply to message #51672] Thu, 24 April 2008 02:54 Go to previous message
Nicolas Richeton is currently offline Nicolas Richeton
Messages: 179
Registered: July 2009
Senior Member
Hi Trevor,

Managing the images this way can lead to a large number of open handles,
but as long as you only display a reasonable number of image, it is ok.

In ShareMedia
( http://sourceforge.net/project/screenshots.php?group_id=1669 62&ssid=69060),
I can display a very large number of Image in a single Gallery so I only
keep a small subset in memory and Images are created on display (using
the paint event).

All SWT events are not yet implemented in Gallery. But if Table or Tree
has this behavior, please open a bug and I'll fix this asap.

--
Nicolas

Trevor Campbell a écrit :
> I am using the Gallery to show a collection of Images and need to
> dispose of the image resources when they are no longer needed.
>
> I tried:
> DisposeListener mImageDisposalListener = new DisposeListener()
> {
> @Override
> public void widgetDisposed(DisposeEvent e)
> {
> GalleryItem item = (GalleryItem) e.widget;
> item.getImage().dispose();
> }
>
> };
> galleryItem.addDisposeListener(mImageDisposalListener);
> but have found that the widgetDisposed event is not being fired when the
> container is disposed of.
>
> Is this a bug? or should I be trying to track and dispose of all the
> image resources myself.
>
Re: Disposing of items in the Gallery [message #589467 is a reply to message #51969] Thu, 24 April 2008 20:26 Go to previous message
Trevor Campbell is currently offline Trevor Campbell
Messages: 23
Registered: July 2009
Junior Member
Thanks Nicolas. I have raised bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=228798

Regards
Trevor
Previous Topic:Need help to control scrolling in the gallery
Next Topic:Date selection widgets and DataBinding
Goto Forum:
  


Current Time: Thu Jul 31 07:34:29 EDT 2014

Powered by FUDForum. Page generated in 0.10506 seconds