[Mono-bugs] [Bug 528825] NotifyIcon race condition
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Aug 6 09:10:54 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=528825
User jxelam at gmail.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=528825#c1
--- Comment #1 from Alex Mason <jxelam at gmail.com> 2009-08-06 07:10:53 MDT ---
Apologies for above, firefox submitted early, not sure how to fix it without
repost.
Description of Problem:
NotifyIcon includes the following function:
private void UpdateSystray()
{
if (icon_bitmap != null) {
icon_bitmap.Dispose();
}
if (icon != null) {
icon_bitmap = icon.ToBitmap();
}
window.Invalidate();
XplatUI.SystrayChange(window.Handle, text, icon, ref tooltip);
}
The issue is icon_bitmap can be referenced by multiple threads, and so can be
accessed after it has been disposed but before a replacement has been
generated.
Steps to reproduce the problem:
I don't have a minimal app handy, but writing something which uses the
functionality and changing the above function to sleep after the dispose for
say 500 milliseconds should ensure a reproduction.
OnPaintInternal in the same class calls new Rectangle (0, 0,
owner.icon_bitmap.Width, owner.icon_bitmap.Height) which will result in
breakage due to this, intermittently.
Additional Information:
I don't know the best way to patch this, but I went with:
private void UpdateSystray()
{
Image old_icon_bitmap = null;
if (icon_bitmap != null) {
old_icon_bitmap = icon_bitmap;
}
if (icon != null) {
icon_bitmap = icon.ToBitmap();
}
if (old_icon_bitmap != null) {
old_icon_bitmap.Dispose();
}
window.Invalidate();
XplatUI.SystrayChange(window.Handle, text, icon, ref tooltip);
}
Which seems to prevent the issue
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list