PureMVC Architects Lounge

PureMVC Manifold => Bug Report => Topic started by: wgr on July 06, 2010, 10:26:38



Title: Little mistake?
Post by: wgr on July 06, 2010, 10:26:38
Hi ev'one. Is it bug or i don't understand anything?

http://trac.puremvc.org/PureMVC_CSharp/browser/trunk/PureMVC/Patterns/Observer/Observer.cs

62                   public void NotifyObserver(INotification notification)
63                   {
64                           object context;
65                           string method;
66   
67                           // Retrieve the current state of the object, then notify outside of our thread safe block
68                           lock (m_syncRoot)
69                           {
70                                   context = NotifyContext;
71                                   method = NotifyMethod;
72                           }
73   
74                           Type t = context.GetType();
75                           BindingFlags f = BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase;
76                           MethodInfo mi = t.GetMethod(NotifyMethod, f); // did u mean local var 'method' here?
77                           mi.Invoke(context, new object[] { notification });
78                   }


Title: Re: Little mistake?
Post by: Tekool on July 06, 2010, 02:01:48
It clearly seems like an error to me too. It has no consequences outside of a multi-threaded context but could lead to a problem as it reads the value directly outside of the lock, which seems to be unwanted.

If Andy doesn't get the message here, could you send him an e-mail (included in the header of script) ?


Title: Re: Little mistake?
Post by: adamczak on July 06, 2010, 08:01:03
Yes, this looks like a bug.  I will fix it and check it in.  I have uninstalled Visual Studio 2005 from my development machines, since it's 2 revisions back, but I should be able to recompile all the dlls.

That's the first bug found in my multi-threaded implementation!