Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Inconsistent need of disposal of resources not directly allocated by client

See http://www.eclipse.org/articles/swt-design-2/swt-design-2.html

Felipe


From: Stephan Aßmus <superstippi@xxxxxx>
To: "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
Date: 09/29/2011 10:52 AM
Subject: Re: [platform-swt-dev] Inconsistent need of disposal of resources not directly allocated by client
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx





Hi,

On 29.09.2011 16:34, Grant Gayed wrote:
> SWT API like Control.getBackground() does not allocate a new native
> resource that needs to be dispose()d by the caller (the
> Color.win32_new() javadoc could be misinterpreted to imply otherwise).
> Such implementations may return a new Color object that wraps the native
> resource, but a new native resource is not allocated. You should never
> dispose() a graphic resource unless you originally created it with "new
> ...". I think that you can get away with over-dispose()ing a Color on
> win32 due to an implementation detail, but doing this on other platforms
> or with other types of graphics resources will cause problems.

Thanks for clearing this up so fast! I actually looked at the GTK
implementation, which calls a similarily named method, but I am relieved
that this stuff is consistently not supposed to be disposed. I will fix
my code where I am already over-disposing.

Thanks again & best regards,
-Stephan
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev




Back to the top