[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r109388 - trunk/moon/src
From: "Jeff Stedfast" <mono-patches-list () lists ! ximian ! com>
Date: 2008-07-31 20:37:33
Message-ID: 20080731203733.A8E4F9472C () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: fejj
Date: 2008-07-31 16:37:33 -0400 (Thu, 31 Jul 2008)
New Revision: 109388
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/dependencyobject.cpp
Log:
2008-07-31 Jeffrey Stedfast <fejj@novell.com>
Fixes bug #412443
* dependencyobject.cpp (DependencyObject::AddPropertyChangeListener):
Ref the listener.
(DependencyObject::RemovePropertyChangeListener): Unref the listener.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-07-31 20:15:31 UTC (rev 109387)
+++ trunk/moon/src/ChangeLog 2008-07-31 20:37:33 UTC (rev 109388)
@@ -1,5 +1,13 @@
2008-07-31 Jeffrey Stedfast <fejj@novell.com>
+ Fixes bug #412443
+
+ * dependencyobject.cpp (DependencyObject::AddPropertyChangeListener):
+ Ref the listener.
+ (DependencyObject::RemovePropertyChangeListener): Unref the listener.
+
+2008-07-31 Jeffrey Stedfast <fejj@novell.com>
+
* animation.cpp (KeyFrameCollection::RemovedFromCollection): Oops,
this needs to chain up to
DependencyObjectCollection::RemovedFromCollection() rather than
Modified: trunk/moon/src/dependencyobject.cpp
===================================================================
--- trunk/moon/src/dependencyobject.cpp 2008-07-31 20:15:31 UTC (rev 109387)
+++ trunk/moon/src/dependencyobject.cpp 2008-07-31 20:37:33 UTC (rev 109388)
@@ -678,10 +678,13 @@
pthread_mutex_unlock (&delayed_unref_mutex);
}
-typedef struct {
- DependencyObject *dob;
+struct Listener {
+ DependencyObject *obj;
DependencyProperty *prop;
-} Listener;
+
+ Listener (DependencyObject *obj, DependencyProperty *prop) { this->obj = obj; \
this->prop = prop; if (obj) obj->ref (); } + ~Listener () { if (obj) obj->unref (); }
+};
//
// Registers @listener as a listener on changes to @child_property of this DO.
@@ -689,10 +692,7 @@
void
DependencyObject::AddPropertyChangeListener (DependencyObject *listener, \
DependencyProperty *child_property) {
- Listener *listen = new Listener ();
- listen->dob = listener;
- listen->prop = child_property;
- listener_list = g_slist_append (listener_list, listen);
+ listener_list = g_slist_append (listener_list, new Listener (listener, \
child_property)); }
//
@@ -702,9 +702,9 @@
DependencyObject::RemovePropertyChangeListener (DependencyObject *listener, \
DependencyProperty *child_property) {
for (GSList *l = listener_list; l; l = l->next) {
- Listener *listen = (Listener*)l->data;
-
- if ((listen->dob == listener) && (child_property == NULL || listen->prop == \
child_property)) { + Listener *listen = (Listener *) l->data;
+
+ if ((listen->obj == listener) && (child_property == NULL || listen->prop == \
child_property)) { listener_list = g_slist_remove_link (listener_list, l);
delete listen;
}
@@ -763,8 +763,8 @@
for (GSList *l = listener_list; l != NULL; l = l->next){
Listener *listener = (Listener*)l->data;
- listener->dob->OnSubPropertyChanged (listener->prop, this, args);
- if (listener->dob == logical_parent)
+ listener->obj->OnSubPropertyChanged (listener->prop, this, args);
+ if (listener->obj == logical_parent)
notified_parent = true;
}
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic