[Mono-dev] [PATCH] MWF: Don't dispose objects that are not owned

Peter Dennis Bartok peter at novonyx.com
Sun Oct 23 10:43:39 EDT 2005


Kornel,

The changes to not call Dispose are ok. The NotifyIcon patch is not ok to 
check in, I want it to use ToBitmap() once instead of every refresh. It 
doesn't matter if ideologically it should use DrawIcon, fact is that we'd be 
creating and throwing away bitmaps at considerable cost on every refresh if 
we use it, so it needs to stay the way it is today.

Peter

-----Original Message-----
From: "Kornél Pál" <kornelpal at hotmail.com>
To: <mono-devel-list at lists.ximian.com>
Date: 23 October, 2005 05:01
Subject: [Mono-dev] [PATCH] MWF: Don't dispose objects that are not owned


>Hi,
>
>Objects should not dispose objects that were not created by them as they 
>may
>be needed by other objects.
>
>This patch fixes the above described problem.
>
>In addition NotifyIcon assumes that Graphics.DrawIcon uses Icon.ToBitmap 
>and
>Graphics.DrawImage that should not be assumed as DrawIcon should be 
>modified
>to have better performance so I modified the code to use Graphics.DrawIcon.
>
>And added HideSystray to NotifyIcon.Dispose as at least on Windows it is
>required. Otherwise notify icon is displayed until you move mouse over even
>when it's host process already terminated. Note that I expecienced that
>notify icon is not removed on Windows but it seems to be a bug in
>XplatUI.SystrayRemove rather than in NotifyIcon.
>
>Please review and approve the patch.
>
>Kornél
> 




More information about the Mono-devel-list mailing list