Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
July 28, 2017, 08:02:50 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: Little mistake?  (Read 4151 times)
wgr
Newbie
*
Posts: 1


View Profile Email
« on: July 06, 2010, 10:26:38 AM »

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                   }
Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW
« Reply #1 on: July 06, 2010, 02:01:48 PM »

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) ?
Logged
adamczak
Moderator
Jr. Member
*****
Posts: 10


View Profile Email
« Reply #2 on: July 06, 2010, 08:01:03 PM »

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!
Logged
Pages: [1]
Print
Jump to: