Author: rolf
Date: 2007-09-19 09:00:51 -0400 (Wed, 19 Sep 2007)
New Revision: 86005
Modified:
trunk/moon/plugin/ChangeLog
trunk/moon/plugin/plugin-class.cpp
trunk/moon/plugin/plugin-class.h
trunk/moon/plugin/plugin.cpp
trunk/moon/src/ChangeLog
trunk/moon/src/animation.cpp
trunk/moon/src/brush.cpp
trunk/moon/src/clock.cpp
trunk/moon/src/collection.cpp
trunk/moon/src/collection.h
trunk/moon/src/dependencyobject.cpp
trunk/moon/src/geometry.cpp
trunk/moon/src/mango.cpp
trunk/moon/src/mango.h
trunk/moon/src/media.cpp
trunk/moon/src/panel.cpp
trunk/moon/src/runtime.cpp
trunk/moon/src/text.cpp
trunk/moon/src/text.h
trunk/moon/src/transform.cpp
trunk/moon/src/xaml.cpp
Log:
* src/panel.cpp: Add a null check.
* src/xaml.cpp: Created a list that contains most created elements in
order to unref them once parsing is finished (we need to unref all
created elements except the top one, but the parser callback
functions don't know which is the top one, so we delay the unrefing
until the end). If parsing is done manually (*_from_str, etc), just
use unref.
* src/text.h, src/text.cpp: Add text_destroy to properly destroy the
default foreground brush on shutdown.
* src/clock.cpp: When we allocate a clock, unref it after adding it to
the group.
* src/collection.h: Store the parent in the Node, since we can't call
obj->GetParent () in a destructor (it will walk up the hierarchy
using the type system, but since the parent can be in the
destructor, the type system isn't reliable anymore).
* src/mango.h, src/mango.cpp: MangoAttrForeground: hold a reference to
the foreground brush, not to the element. Add a
mango_renderer_get_type_safe that can reinitialize static variables
(after a libmoon reload) from glib.
* src/geometry.cpp, src/transform.cpp, src/brush.cpp: Use
Value::CreateUnref for default values.
* src/collection.cpp: Store the parent in the Node, since we can't call
obj->GetParent () in a destructor (it will walk up the hierarchy
using the type system, but since the parent can be in the
destructor itself, the type system isn't reliable anymore).
* src/dependencyobject.cpp: Attachee: don't hold a ref to the container
anymore.
* src/media.cpp: Sprinkle a few unrefs here and there.
* src/animation.cpp: Don't ref root_clock, CreateClock already gives us
a ref. Add a null check in the Storyboard destructor. Use
Value::CreateUnref for default values.
* src/runtime.cpp: Attach: Don't attach a null element. Call
text_destroy on shutdown.
* plugin/plugin.cpp: Remove a printf.
* plugin/plugin-class.cpp, plugin/plugin-class.h: Apparently invalidate
isn't always called for our MoonlightObjects (though deallocate
is). Create a Dispose method that does what invalidate did (and
call it from Invalidate), and keep track if it has been called or
not (allows deallocate to call it if invalidate wasn't called by
mozilla). Make Dispose virtual so that the base deallocator can
call it for all derived classes (which also means that we only need
the base invalidate method), and add a virtual destructor so that
the base deallocator can also delete the object (and remove all
other *_deallocator methods). proxy_listener_to_javascript: release
objects at the end of the method.
Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/plugin/ChangeLog 2007-09-19 13:00:51 UTC (rev 86005)
@@ -1,3 +1,17 @@
+2007-09-19 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * plugin.cpp: Remove a printf.
+ * plugin-class.cpp, plugin-class.h: Apparently invalidate isn't always
+ called for our MoonlightObjects (though deallocate is). Create a
Dispose
+ method that does what invalidate did (and call it from Invalidate),
and
+ keep track if it has been called or not (allows deallocate to call it
if
+ invalidate wasn't called by mozilla). Make Dispose virtual so that the
+ base deallocator can call it for all derived classes (which also means
+ that we only need the base invalidate method), and add a virtual
+ destructor so that the base deallocator can also delete the object
(and
+ remove all other *_deallocator methods). proxy_listener_to_javascript:
+ release objects at the end of the method.
+
2007-09-17 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* plugin.cpp, plugin.h, moonlight.cs: Move callbacks from
PluginXamlLoader
Modified: trunk/moon/plugin/plugin-class.cpp
===================================================================
--- trunk/moon/plugin/plugin-class.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/plugin/plugin-class.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -300,8 +300,6 @@
MoonlightEventObjectObject *depobj = EventObjectCreateWrapper
(proxy->instance, js_sender);
- NPN_RetainObject (depobj); // XXX leak?
-
OBJECT_TO_NPVARIANT (depobj, args[0]);
EventArgsWrapper event_args_wrapper = get_wrapper_for_event_name
(proxy->event_name);
@@ -320,17 +318,15 @@
// printf ("!proxy->is_func\n");
/* the event listener was added with a JS string (the function
name) */
NPObject *object = NULL;
- if (NPERR_NO_ERROR != NPN_GetValue(proxy->instance,
NPNVWindowNPObject, &object)) {
- return;
+ if (NPERR_NO_ERROR == NPN_GetValue(proxy->instance,
NPNVWindowNPObject, &object)) {
+ if (NPN_Invoke (proxy->instance, object, NPID
((char*)proxy->callback),
+ args, 2, &result))
+ NPN_ReleaseVariantValue (&result);
}
-
- if (NPN_Invoke (proxy->instance, object, NPID
((char*)proxy->callback),
- args, 2, &result))
- NPN_ReleaseVariantValue (&result);
-
- // XXX not needed
- // NPN_ReleaseObject (object);
}
+
+ NPN_ReleaseObject (depobj);
+ NPN_ReleaseObject (NPVARIANT_TO_OBJECT (args [1]));
}
@@ -347,17 +343,9 @@
return new MoonlightEventListenerObject (instance);
}
-static void
-event_listener_deallocate (NPObject *npobject)
-{
- delete (MoonlightEventListenerObject *) npobject;
-}
-
-
MoonlightEventListenerType::MoonlightEventListenerType ()
{
allocate = event_listener_allocate;
- deallocate = event_listener_deallocate;
}
MoonlightEventListenerType *MoonlightEventListenerClass;
@@ -370,11 +358,6 @@
return new MoonlightErrorEventArgs (instance);
}
-static void
-erroreventargs_deallocate (NPObject *npobject)
-{
- delete (MoonlightErrorEventArgs*)npobject;
-}
static bool
erroreventargs_has_property (NPObject *npobj, NPIdentifier name)
@@ -458,7 +441,6 @@
MoonlightErrorEventArgsType::MoonlightErrorEventArgsType ()
{
allocate = erroreventargs_allocate;
- deallocate = erroreventargs_deallocate;
hasProperty = erroreventargs_has_property;
getProperty = erroreventargs_get_property;
}
@@ -472,12 +454,6 @@
return new MoonlightPoint (instance);
}
-static void
-point_deallocate (NPObject *npobject)
-{
- delete (MoonlightPoint*)npobject;
-}
-
static bool
point_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -521,7 +497,6 @@
MoonlightPointType::MoonlightPointType ()
{
allocate = point_allocate;
- deallocate = point_deallocate;
hasProperty = point_has_property;
getProperty = point_get_property;
setProperty = point_set_property;
@@ -536,12 +511,6 @@
return new MoonlightRect (instance);
}
-static void
-rect_deallocate (NPObject *npobject)
-{
- delete (MoonlightRect*)npobject;
-}
-
static bool
rect_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -603,7 +572,6 @@
MoonlightRectType::MoonlightRectType ()
{
allocate = rect_allocate;
- deallocate = rect_deallocate;
hasProperty = rect_has_property;
getProperty = rect_get_property;
setProperty = rect_set_property;
@@ -619,12 +587,6 @@
return new MoonlightDuration (instance);
}
-static void
-duration_deallocate (NPObject *npobject)
-{
- delete (MoonlightDuration*)npobject;
-}
-
static bool
duration_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -667,7 +629,6 @@
MoonlightDurationType::MoonlightDurationType ()
{
allocate = duration_allocate;
- deallocate = duration_deallocate;
hasProperty = duration_has_property;
getProperty = duration_get_property;
setProperty = duration_set_property;
@@ -683,12 +644,6 @@
return new MoonlightTimeSpan (instance);
}
-static void
-timespan_deallocate (NPObject *npobject)
-{
- delete (MoonlightTimeSpan*)npobject;
-}
-
static bool
timespan_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -731,7 +686,6 @@
MoonlightTimeSpanType::MoonlightTimeSpanType ()
{
allocate = timespan_allocate;
- deallocate = timespan_deallocate;
hasProperty = timespan_has_property;
getProperty = timespan_get_property;
setProperty = timespan_set_property;
@@ -749,21 +703,13 @@
return new MoonlightMouseEventArgsObject (instance);
}
-static void
-mouse_event_deallocate (NPObject *npobject)
+void
+MoonlightMouseEventArgsObject::Dispose ()
{
- delete (MoonlightMouseEventArgsObject*)npobject;
-}
+ MoonlightObject::Dispose ();
-static void
-mouse_event_invalidate (NPObject *npobject)
-{
- MoonlightMouseEventArgsObject *ea =
(MoonlightMouseEventArgsObject*)npobject;
-// XXX apparently we don't need to do this?
-// if (ea->position)
-// NPN_ReleaseObject (ea->position);
- ea->x = -1;
- ea->y = -1;
+ x = -1;
+ y = -1;
}
static bool
@@ -835,8 +781,6 @@
MoonlightMouseEventArgsType::MoonlightMouseEventArgsType ()
{
allocate = mouse_event_allocate;
- deallocate = mouse_event_deallocate;
- invalidate = mouse_event_invalidate;
hasProperty = mouse_event_has_property;
getProperty = mouse_event_get_property;
@@ -855,18 +799,12 @@
return new MoonlightKeyboardEventArgsObject (instance);
}
-static void
-keyboard_event_deallocate (NPObject *npobject)
+void
+MoonlightKeyboardEventArgsObject::Dispose ()
{
- delete (MoonlightKeyboardEventArgsObject*)npobject;
+ MoonlightObject::Dispose ();
}
-static void
-keyboard_event_invalidate (NPObject *npobject)
-{
-
-}
-
static bool
keyboard_event_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -918,8 +856,6 @@
MoonlightKeyboardEventArgsType::MoonlightKeyboardEventArgsType ()
{
allocate = keyboard_event_allocate;
- deallocate = keyboard_event_deallocate;
- invalidate = keyboard_event_invalidate;
hasProperty = keyboard_event_has_property;
getProperty = keyboard_event_get_property;
@@ -949,13 +885,33 @@
static void
_deallocate (NPObject *npobj)
{
+ MoonlightObject* obj = (MoonlightObject*) npobj;
+ if (!obj->disposed)
+ obj->Dispose ();
delete (MoonlightObject*)npobj;
}
+MoonlightObject::~MoonlightObject ()
+{
+ if (!disposed) {
+ // Can't call Dispose from here, since the derived classes'
vtbls have already
+ // been destroyed.
+ printf ("Undisposed object.\n");
+ // print_stack_trace ();
+ }
+}
+
+void
+MoonlightObject::Dispose ()
+{
+ disposed = true;
+}
+
static void
_invalidate (NPObject *npobj)
{
- // nothing to do
+ MoonlightObject* o = (MoonlightObject*) npobj;
+ o->Dispose ();
}
static bool
@@ -1035,26 +991,18 @@
return new MoonlightScriptControlObject (instance);
}
-static void
-moonlight_scriptable_control_deallocate (NPObject *npobj)
+void
+MoonlightScriptControlObject::Dispose ()
{
- delete (MoonlightScriptControlObject*)npobj;
-}
+ MoonlightObject::Dispose ();
-static void
-moonlight_scriptable_control_invalidate (NPObject *npobj)
-{
- MoonlightScriptControlObject *control =
(MoonlightScriptControlObject*)npobj;
+ if (settings)
+ NPN_ReleaseObject (settings);
+ settings = NULL;
-// XXX apparently we don't need to do this?
-// if (control->settings)
-// NPN_ReleaseObject (control->settings);
- control->settings = NULL;
-
-// XXX apparently we don't need to do this?
-// if (control->content)
-// NPN_ReleaseObject (control->content);
- control->content = NULL;
+ if (content)
+ NPN_ReleaseObject (content);
+ content = NULL;
}
static bool
@@ -1201,8 +1149,6 @@
MoonlightScriptControlType::MoonlightScriptControlType ()
{
allocate = moonlight_scriptable_control_allocate;
- deallocate = moonlight_scriptable_control_deallocate;
- invalidate = moonlight_scriptable_control_invalidate;
hasProperty = moonlight_scriptable_control_has_property;
getProperty = moonlight_scriptable_control_get_property;
@@ -1332,26 +1278,20 @@
return new MoonlightContentObject (instance);
}
-static void
-moonlight_content_deallocate (NPObject *npobj)
+void
+MoonlightContentObject::Dispose ()
{
- delete (MoonlightContentObject*)npobj;
-}
+ MoonlightObject::Dispose ();
-static void
-moonlight_content_invalidate (NPObject *npobj)
-{
- MoonlightContentObject *content = (MoonlightContentObject*)npobj;
-
/* XXX free the registered_scriptable_objects hash */
- DEBUG_WARN_NOTIMPLEMENTED ("need to free registered scriptable
objects");
+ //DEBUG_WARN_NOTIMPLEMENTED ("need to free registered scriptable
objects");
- if (content->resizeProxy)
- delete content->resizeProxy;
- content->resizeProxy = NULL;
- if (content->fullScreenChangeProxy)
- delete content->fullScreenChangeProxy;
- content->fullScreenChangeProxy = NULL;
+ if (resizeProxy)
+ delete resizeProxy;
+ resizeProxy = NULL;
+ if (fullScreenChangeProxy)
+ delete fullScreenChangeProxy;
+ fullScreenChangeProxy = NULL;
}
static const char *const
@@ -1529,6 +1469,7 @@
MoonlightEventObjectObject *depobj =
EventObjectCreateWrapper
(((MoonlightObject*)npobj)->instance, dep);
+ dep->unref ();
OBJECT_TO_NPVARIANT (depobj, *result);
@@ -1569,8 +1510,6 @@
MoonlightContentType::MoonlightContentType ()
{
allocate = moonlight_content_allocate;
- deallocate = moonlight_content_deallocate;
- invalidate = moonlight_content_invalidate;
hasProperty = moonlight_content_has_property;
getProperty = moonlight_content_get_property;
@@ -1606,18 +1545,12 @@
return new MoonlightDependencyObjectObject (instance);
}
-static void
-moonlight_dependency_object_deallocate (NPObject *npobj)
+void
+MoonlightDependencyObjectObject::Dispose ()
{
- delete (MoonlightDependencyObjectObject*)npobj;
+ MoonlightEventObjectObject::Dispose ();
}
-static void
-moonlight_dependency_object_invalidate (NPObject *npobj)
-{
- moonlight_event_object_invalidate (npobj);
-}
-
static DependencyProperty*
_get_dependency_property (DependencyObject *obj, char *attrname)
{
@@ -1929,8 +1862,6 @@
MoonlightDependencyObjectType::MoonlightDependencyObjectType ()
{
allocate = moonlight_dependency_object_allocate;
- deallocate = moonlight_dependency_object_deallocate;
- invalidate = moonlight_dependency_object_invalidate;
hasProperty = moonlight_dependency_object_has_property;
setProperty = moonlight_dependency_object_set_property;
@@ -1951,22 +1882,16 @@
return new MoonlightEventObjectObject (instance);
}
-static void
-moonlight_event_object_deallocate (NPObject *npobj)
+void
+MoonlightEventObjectObject::Dispose ()
{
- delete (MoonlightEventObjectObject*)npobj;
+ MoonlightObject::Dispose ();
+
+ if (eo)
+ eo->unref ();
+ eo = NULL;
}
-static void
-moonlight_event_object_invalidate (NPObject *npobj)
-{
- MoonlightEventObjectObject *eo = (MoonlightEventObjectObject*)npobj;
-
- if (eo->eo)
- eo->eo->unref ();
- eo->eo = NULL;
-}
-
static bool
moonlight_event_object_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -2001,8 +1926,6 @@
MoonlightEventObjectType::MoonlightEventObjectType ()
{
allocate = moonlight_event_object_allocate;
- deallocate = moonlight_event_object_deallocate;
- invalidate = moonlight_event_object_invalidate;
hasProperty = moonlight_event_object_has_property;
setProperty = moonlight_event_object_set_property;
@@ -2704,12 +2627,6 @@
return new MoonlightControlObject (instance);
}
-static void
-moonlight_control_deallocate (NPObject *npobject)
-{
- delete (MoonlightControlObject*)npobject;
-}
-
static bool
moonlight_control_has_property (NPObject *npobj, NPIdentifier name)
{
@@ -2795,7 +2712,6 @@
MoonlightControlType::MoonlightControlType ()
{
allocate = moonlight_control_allocate;
- deallocate = moonlight_control_deallocate;
hasProperty = moonlight_control_has_property;
getProperty = moonlight_control_get_property;
setProperty = moonlight_control_set_property;
@@ -2832,21 +2748,15 @@
return new MoonlightScriptableObjectObject (instance);
}
-static void
-moonlight_scriptable_object_deallocate (NPObject *npobj)
+void
+MoonlightScriptableObjectObject::Dispose ()
{
- delete (MoonlightScriptableObjectObject*)npobj;
-}
+ MoonlightObject::Dispose ();
-static void
-moonlight_scriptable_object_invalidate (NPObject *npobj)
-{
- MoonlightScriptableObjectObject *sobj =
(MoonlightScriptableObjectObject*)npobj;
-
- if (sobj->managed_scriptable) {
+ if (managed_scriptable) {
// XXX unref the scriptable object however we need to.
}
- sobj->managed_scriptable = NULL;
+ managed_scriptable = NULL;
// XXX free the properties, events, and methods hashes.
}
@@ -2986,8 +2896,6 @@
MoonlightScriptableObjectType::MoonlightScriptableObjectType ()
{
allocate = moonlight_scriptable_object_allocate;
- deallocate = moonlight_scriptable_object_deallocate;
- invalidate = moonlight_scriptable_object_invalidate;
hasProperty = moonlight_scriptable_object_has_property;
setProperty = moonlight_scriptable_object_set_property;
Modified: trunk/moon/plugin/plugin-class.h
===================================================================
--- trunk/moon/plugin/plugin-class.h 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/plugin/plugin-class.h 2007-09-19 13:00:51 UTC (rev 86005)
@@ -69,11 +69,16 @@
{
this->instance = instance;
this->moonlight_type = Type::INVALID;
+ this->disposed = false;
}
+ virtual void Dispose ();
+ virtual ~MoonlightObject ();
NPP instance;
Type::Kind moonlight_type;
+ bool disposed;
};
+static void _invalidate (NPObject *npobj);
/*** MoonlightEventListenerObject
******************************************************/
struct MoonlightEventListenerType : MoonlightObjectType {
@@ -178,6 +183,7 @@
MoonlightMouseEventArgsObject (NPP instance)
: MoonlightObject (instance), state (0), x (-1), y (-1) { }
+ virtual void Dispose ();
int state;
double x;
double y;
@@ -194,6 +200,7 @@
MoonlightKeyboardEventArgsObject (NPP instance)
: MoonlightObject (instance), state (0), key (0), platformcode (0) { }
+ virtual void Dispose ();
int state;
int key;
int platformcode;
@@ -223,6 +230,7 @@
{
registered_scriptable_objects = g_hash_table_new
(g_direct_hash, g_direct_equal);
}
+ virtual void Dispose ();
GHashTable *registered_scriptable_objects;
@@ -246,6 +254,7 @@
settings = NPN_CreateObject (instance, MoonlightSettingsClass);
}
+ virtual void Dispose ();
NPObject *content;
NPObject *settings;
};
@@ -264,13 +273,18 @@
moonlight_type = Type::EVENTOBJECT;
}
- void SetEventObject (EventObject *eo)
+ void SetEventObject (EventObject *eventobject)
{
- this->eo = eo;
if (eo)
+ eo->unref ();
+
+ eo = eventobject;
+ if (eo)
eo->ref ();
}
+ virtual void Dispose ();
+
EventObject *eo;
};
static void moonlight_event_object_invalidate (NPObject *npobj);
@@ -299,6 +313,7 @@
g_assert (eo->GetObjectType () >= Type::DEPENDENCY_OBJECT);
return (DependencyObject*) eo;
}
+ virtual void Dispose ();
};
extern MoonlightDependencyObjectObject* DependencyObjectCreateWrapper (NPP
instance, DependencyObject *obj);
@@ -400,6 +415,7 @@
methods = g_hash_table_new (g_direct_hash, g_direct_equal);
events = g_hash_table_new (g_direct_hash, g_direct_equal);
}
+ virtual void Dispose ();
gpointer managed_scriptable;
GHashTable *properties;
Modified: trunk/moon/plugin/plugin.cpp
===================================================================
--- trunk/moon/plugin/plugin.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/plugin/plugin.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -777,7 +777,7 @@
return;
}
#endif
- printf ("PluginXamlLoader::HookupEvent (%p, %s, %s)\n", target, name,
value);
+ //printf ("PluginXamlLoader::HookupEvent (%p, %s, %s)\n", target, name,
value);
event_object_add_javascript_listener ((EventObject*) target, plugin,
name, value);
}
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/ChangeLog 2007-09-19 13:00:51 UTC (rev 86005)
@@ -1,3 +1,37 @@
+2007-09-19 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * panel.cpp: Add a null check.
+ * xaml.cpp: Created a list that contains most created elements in order
to
+ unref them once parsing is finished (we need to unref all created
+ elements except the top one, but the parser callback functions don't
+ know which is the top one, so we delay the unrefing until the end). If
+ parsing is done manually (*_from_str, etc), just use unref.
+ * text.h, text.cpp: Add text_destroy to properly destroy the default
+ foreground brush on shutdown.
+ * clock.cpp: When we allocate a clock, unref it after adding it to the
+ group.
+ * collection.h: Store the parent in the Node, since we can't call
+ obj->GetParent () in a destructor (it will walk up the hierarchy using
+ the type system, but since the parent can be in the destructor, the
type
+ system isn't reliable anymore).
+ * mango.h, mango.cpp: MangoAttrForeground: hold a reference to the
+ foreground brush, not to the element. Add a
mango_renderer_get_type_safe
+ that can reinitialize static variables (after a libmoon reload) from
+ glib.
+ * geometry.cpp, transform.cpp, brush.cpp: Use Value::CreateUnref for
default
+ values.
+ * collection.cpp: Store the parent in the Node, since we can't call
+ obj->GetParent () in a destructor (it will walk up the hierarchy using
+ the type system, but since the parent can be in the destructor itself,
+ the type system isn't reliable anymore).
+ * dependencyobject.cpp: Attachee: don't hold a ref to the container
anymore.
+ * media.cpp: Sprinkle a few unrefs here and there.
+ * animation.cpp: Don't ref root_clock, CreateClock already gives us a
ref.
+ Add a null check in the Storyboard destructor. Use Value::CreateUnref
+ for default values.
+ * runtime.cpp: Attach: Don't attach a null element. Call text_destroy on
+ shutdown.
+
2007-09-18 Jeffrey Stedfast <[EMAIL PROTECTED]>
Continued fixes to go along with Rolf's other TextBlock leak
Modified: trunk/moon/src/animation.cpp
===================================================================
--- trunk/moon/src/animation.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/animation.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -194,7 +194,6 @@
// Timeline A is a child of TimelineGroup B, then Clock cA
// will be a child of ClockGroup cB.
root_clock = CreateClock ();
- root_clock->ref ();
root_clock->AddHandler (root_clock->CompletedEvent, invoke_completed,
this);
// walk the clock tree hooking up the correct properties and
@@ -301,11 +300,13 @@
Storyboard::~Storyboard ()
{
- printf ("Clock %p (ref=%d)\n", root_clock, root_clock->refcount);
- Stop ();
- TimeManager::Instance()->RemoveChild (root_clock);
- printf ("Unrefing Clock %p (ref=%d)\n", root_clock,
root_clock->refcount);
- root_clock->unref ();
+ if (root_clock) {
+ //printf ("Clock %p (ref=%d)\n", root_clock,
root_clock->refcount);
+ Stop ();
+ TimeManager::Instance()->RemoveChild (root_clock);
+ //printf ("Unrefing Clock %p (ref=%d)\n", root_clock,
root_clock->refcount);
+ root_clock->unref ();
+ }
}
DependencyProperty* BeginStoryboard::StoryboardProperty;
@@ -1176,7 +1177,7 @@
DoubleAnimationUsingKeyFrames::DoubleAnimationUsingKeyFrames()
{
- this->SetValue (DoubleAnimationUsingKeyFrames::KeyFramesProperty, Value
(new DoubleKeyFrameCollection ()));
+ this->SetValue (DoubleAnimationUsingKeyFrames::KeyFramesProperty,
Value::CreateUnref (new DoubleKeyFrameCollection ()));
}
DoubleAnimationUsingKeyFrames::~DoubleAnimationUsingKeyFrames ()
Modified: trunk/moon/src/brush.cpp
===================================================================
--- trunk/moon/src/brush.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/brush.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -257,7 +257,7 @@
GradientBrush::GradientBrush ()
{
- this->SetValue (GradientBrush::GradientStopsProperty, Value (new
GradientStopCollection ()));
+ this->SetValue (GradientBrush::GradientStopsProperty,
Value::CreateUnref (new GradientStopCollection ()));
}
GradientBrush::~GradientBrush ()
Modified: trunk/moon/src/clock.cpp
===================================================================
--- trunk/moon/src/clock.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/clock.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -835,8 +835,11 @@
Collection::Node *node;
node = (Collection::Node *) collection->list->First ();
- for ( ; node != NULL; node = (Collection::Node *) node->next)
- group->AddChild (((Timeline *) node->obj)->AllocateClock ());
+ for ( ; node != NULL; node = (Collection::Node *) node->next) {
+ Clock* clock = ((Timeline *) node->obj)->AllocateClock ();
+ group->AddChild (clock);
+ clock->unref ();
+ }
return group;
}
Modified: trunk/moon/src/collection.cpp
===================================================================
--- trunk/moon/src/collection.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/collection.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -26,11 +26,12 @@
dob->SetParent (parent);
dob->ref ();
obj = dob;
+ this->parent = parent;
}
Collection::Node::~Node ()
{
- obj->Detach (NULL, obj->GetParent ());
+ obj->Detach (NULL, parent);
obj->SetParent (NULL);
obj->unref ();
}
Modified: trunk/moon/src/collection.h
===================================================================
--- trunk/moon/src/collection.h 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/collection.h 2007-09-19 13:00:51 UTC (rev 86005)
@@ -23,7 +23,7 @@
public:
class Node : public List::Node {
public:
- DependencyObject *obj;
+ DependencyObject *obj, *parent;
Node (DependencyObject *dob, DependencyObject *parent);
virtual ~Node ();
Modified: trunk/moon/src/dependencyobject.cpp
===================================================================
--- trunk/moon/src/dependencyobject.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/dependencyobject.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -115,7 +115,6 @@
{
Attachee *att = new Attachee ();
att->dob = container;
- base_ref (att->dob);
att->prop = property;
attached_list = g_slist_append (attached_list, att);
}
@@ -128,7 +127,6 @@
if (att->dob == container && att->prop == property) {
attached_list = g_slist_remove_link (attached_list, l);
- base_unref (att->dob);
delete att;
break;
}
@@ -350,7 +348,6 @@
void free_attachee (gpointer data, gpointer user_data)
{
Attachee* att = (Attachee*) data;
- base_unref (att->dob);
delete att;
}
Modified: trunk/moon/src/geometry.cpp
===================================================================
--- trunk/moon/src/geometry.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/geometry.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -313,7 +313,7 @@
PathGeometry::PathGeometry ()
{
- this->SetValue (PathGeometry::FiguresProperty, Value::CreateUnrefPtr
(new PathFigureCollection ()));
+ this->SetValue (PathGeometry::FiguresProperty, Value::CreateUnref (new
PathFigureCollection ()));
}
void
@@ -490,7 +490,7 @@
PathFigure::PathFigure ()
{
- this->SetValue (PathFigure::SegmentsProperty, Value::CreateUnrefPtr
(new PathSegmentCollection ()));
+ this->SetValue (PathFigure::SegmentsProperty, Value::CreateUnref (new
PathSegmentCollection ()));
}
PathFigure::~PathFigure ()
Modified: trunk/moon/src/mango.cpp
===================================================================
--- trunk/moon/src/mango.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/mango.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -42,6 +42,32 @@
G_DEFINE_TYPE (MangoRenderer, mango_renderer, PANGO_TYPE_RENDERER)
+/*
+ This is not the right way of doing this.
+ If libmoon is reloaded, the function callbacks registered with
+ glib might be pointing to anywhere.
+ This only works if libmoon is reloaded to where it was first loaded.
+*/
+GType
+mango_renderer_get_type_safe ()
+{
+ static GType type = 0;
+
+ if (type != 0)
+ return type;
+
+ type = g_type_from_name ("MangoRenderer");
+
+ if (type != 0) {
+ mango_renderer_parent_class = g_type_class_peek (g_type_parent
(type));
+ return type;
+ }
+
+ type = mango_renderer_get_type ();
+ return type;
+}
+
+
static void
mango_renderer_class_init (MangoRendererClass *klass)
{
@@ -236,8 +262,8 @@
{
MangoAttrForeground *fg = (MangoAttrForeground *) attr;
- if (fg->element)
- fg->element->unref ();
+ if (fg->foreground)
+ fg->foreground->unref ();
g_free (attr);
}
@@ -281,8 +307,8 @@
attr = g_new (MangoAttrForeground, 1);
attr->attr.klass = &klass;
- if (element)
- element->ref ();
+ if (foreground)
+ foreground->ref ();
attr->element = element;
attr->foreground = foreground;
Modified: trunk/moon/src/mango.h
===================================================================
--- trunk/moon/src/mango.h 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/mango.h 2007-09-19 13:00:51 UTC (rev 86005)
@@ -15,7 +15,9 @@
#include "brush.h"
-#define MOON_TYPE_MANGO_RENDERER (mango_renderer_get_type())
+GType mango_renderer_get_type_safe ();
+
+#define MOON_TYPE_MANGO_RENDERER (mango_renderer_get_type_safe ())
#define MANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
MOON_TYPE_MANGO_RENDERER, MangoRenderer))
#define MOON_IS_MANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE
((object), MOON_TYPE_MANGO_RENDERER))
#define MANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
MOON_TYPE_MANGO_RENDERER, MangoRendererClass))
Modified: trunk/moon/src/media.cpp
===================================================================
--- trunk/moon/src/media.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/media.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -217,7 +217,9 @@
MediaFailedEvent = RegisterEvent ("MediaFailed");
MediaOpenedEvent = RegisterEvent ("MediaOpened");
- media_element_set_markers (this, new TimelineMarkerCollection ());
+ TimelineMarkerCollection* col = new TimelineMarkerCollection ();
+ media_element_set_markers (this, col);
+ col->unref ();
}
void
@@ -225,7 +227,7 @@
{
if (downloader) {
Value *value = downloader->GetValue (Downloader::UriProperty);
- printf ("aborting downloader for %s\n", value ? value->AsString
() : "(null)");
+ //printf ("aborting downloader for %s\n", value ?
value->AsString () : "(null)");
downloader_abort (downloader);
downloader->unref ();
downloader = NULL;
@@ -382,7 +384,7 @@
source = MediaSource::CreateSource (this, media_base_get_source (this),
filename);
- printf ("video source changed to `%s'\n", filename);
+ //printf ("video source changed to `%s'\n", filename);
g_free (filename);
// FIXME: specify which audio stream index the player should use
@@ -400,7 +402,7 @@
return;
}
- printf ("video succesfully opened\n");
+ //printf ("video succesfully opened\n");
media_element_set_can_seek (this, mplayer->CanSeek ());
media_element_set_can_pause (this, mplayer->CanPause ());
@@ -415,7 +417,7 @@
Invalidate ();
- printf ("DownloaderComplete: autoplay = %s\n", autoplay ? "true" :
"false");
+ //printf ("DownloaderComplete: autoplay = %s\n", autoplay ? "true" :
"false");
if (autoplay || play_pending)
Play ();
@@ -487,12 +489,12 @@
void
MediaElement::Play ()
{
- printf ("MediaElement::Play() requested\n");
+ //printf ("MediaElement::Play() requested\n");
if (downloader && downloader->Completed () && timeout_id == 0 &&
!mplayer->IsPlaying ()) {
timeout_id = source->Play ();
media_element_set_current_state (this, "Playing");
- printf ("video playing, timeout_id = %d\n", timeout_id);
+ //printf ("video playing, timeout_id = %d\n", timeout_id);
play_pending = false;
} else {
play_pending = true;
@@ -571,15 +573,15 @@
{
loaded = true;
- printf ("MediaElement::OnLoaded: ");
+ //printf ("MediaElement::OnLoaded: ");
if (downloader && downloader->Completed ()) {
- printf ("downloader is complete\n");
+ //printf ("downloader is complete\n");
DownloaderComplete ();
} else if (downloader) {
- printf ("downloader not yet completed\n");
+ //printf ("downloader not yet completed\n");
} else {
- printf ("no downloader set\n");
+ //printf ("no downloader set\n");
}
MediaBase::OnLoaded ();
@@ -594,11 +596,12 @@
if (uri && *uri) {
Downloader *dl = new Downloader ();
- printf ("setting media source to %s\n", uri);
+ //printf ("setting media source to %s\n", uri);
downloader_open (dl, "GET", uri);
SetSource (dl, "");
+ dl->unref ();
} else {
- printf ("trying to set media source to empty\n");
+ //printf ("trying to set media source to empty\n");
DownloaderAbort ();
}
@@ -611,7 +614,7 @@
}
} else if (prop == MediaElement::AutoPlayProperty) {
// no state to change
- printf ("AutoPlay set to %s\n", media_element_get_auto_play
(this) ? "true" : "false");
+ //printf ("AutoPlay set to %s\n", media_element_get_auto_play
(this) ? "true" : "false");
} else if (prop == MediaElement::BalanceProperty) {
mplayer->SetBalance (media_element_get_balance (this));
} else if (prop == MediaElement::BufferingProgressProperty) {
@@ -1282,6 +1285,7 @@
Downloader *dl = new Downloader ();
downloader_open (dl, "GET", source);
SetSource (dl, "");
+ dl->unref ();
}
if (prop->type != Type::IMAGE) {
Modified: trunk/moon/src/panel.cpp
===================================================================
--- trunk/moon/src/panel.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/panel.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -69,7 +69,8 @@
}
VisualCollection *children = GetChildren ();
- children->Clear();
+ if (children)
+ children->Clear();
}
#define DEBUG_BOUNDS 0
Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/runtime.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -250,6 +250,9 @@
{
bool first = FALSE;
+ if (!element)
+ return;
+
if (!Type::Find (element->GetObjectType())->IsSubclassOf
(Type::CANVAS)) {
printf ("Unsupported toplevel\n");
return;
@@ -986,7 +989,7 @@
void
Surface::SetBackgroundColor (Color *color)
{
- printf("YO");
+ //printf("YO");
background_color = new Color (*color);
if (drawing_area)
gtk_widget_queue_draw (drawing_area);
@@ -1105,6 +1108,7 @@
return;
animation_destroy ();
+ text_destroy ();
TimeManager::Instance()->Shutdown ();
DependencyObject::Shutdown ();
@@ -1112,7 +1116,7 @@
printf ("Runtime destroyed. Object tracking summary:\n");
printf ("\tObjects created: %i\n", Base::objects_created);
printf ("\tObjects destroyed: %i\n", Base::objects_destroyed);
- printf ("\tDifference: %i\n", Base::objects_created -
Base::objects_destroyed);
+ printf ("\tDifference: %i (%.1f%%)\n", Base::objects_created -
Base::objects_destroyed, (100.0 * Base::objects_destroyed) /
Base::objects_created);
int counter = 10;
Base::objects_alive = g_list_reverse (Base::objects_alive);
g_list_foreach (Base::objects_alive, print_object_data, &counter);
Modified: trunk/moon/src/text.cpp
===================================================================
--- trunk/moon/src/text.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/text.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -76,19 +76,20 @@
}
+SolidColorBrush *default_foreground_brush = NULL;
+
static Brush *
default_foreground (void)
{
- static SolidColorBrush *brush = NULL;
- if (!brush) {
- brush = new SolidColorBrush ();
+ if (!default_foreground_brush) {
+ default_foreground_brush = new SolidColorBrush ();
Color *color = color_from_str ("black");
- solid_color_brush_set_color (brush, color);
+ solid_color_brush_set_color (default_foreground_brush, color);
delete color;
}
- return (Brush *) brush;
+ return (Brush *) default_foreground_brush;
}
@@ -648,6 +649,7 @@
mango_renderer_set_cairo_context (renderer, cr);
mango_renderer_layout_path (renderer, layout);
pango_layout_get_pixel_size (layout, &w, &h);
+ pango_attr_list_unref (attrs);
if (clip && (h > clip_height))
text_block_set_actual_height (this, (double) clip_height);
@@ -1130,6 +1132,12 @@
glyphs->SetValue (Glyphs::UnicodeStringProperty, Value (value));
}
+void
+text_destroy (void)
+{
+ base_unref (default_foreground_brush);
+ default_foreground_brush = NULL;
+}
void
Modified: trunk/moon/src/text.h
===================================================================
--- trunk/moon/src/text.h 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/text.h 2007-09-19 13:00:51 UTC (rev 86005)
@@ -68,8 +68,8 @@
void text_init (void);
+void text_destroy (void);
-
class Inline : public DependencyObject {
public:
static DependencyProperty *FontFamilyProperty;
Modified: trunk/moon/src/transform.cpp
===================================================================
--- trunk/moon/src/transform.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/transform.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -400,7 +400,7 @@
TransformGroup::TransformGroup ()
{
- this->SetValue (TransformGroup::ChildrenProperty, Value (new
TransformCollection ()));
+ this->SetValue (TransformGroup::ChildrenProperty, Value::CreateUnref
(new TransformCollection ()));
}
TransformGroup::~TransformGroup ()
Modified: trunk/moon/src/xaml.cpp
===================================================================
--- trunk/moon/src/xaml.cpp 2007-09-19 12:50:02 UTC (rev 86004)
+++ trunk/moon/src/xaml.cpp 2007-09-19 13:00:51 UTC (rev 86005)
@@ -104,6 +104,12 @@
}
};
+void
+unref_xaml_element (gpointer data, gpointer user_data)
+{
+ DependencyObject* dob = (DependencyObject*) data;
+ base_unref (dob);
+}
class XamlParserInfo {
public:
@@ -124,19 +130,29 @@
ParserErrorEventArgs *error_args;
XamlLoader* loader;
+ GList* created_elements;
+ void AddCreatedElement (DependencyObject* element)
+ {
+ created_elements = g_list_prepend (created_elements, element);
+ }
+
XamlParserInfo (XML_Parser parser, const char *file_name) :
parser (parser), file_name (file_name), namescope (new
NameScope()), top_element (NULL),
current_namespace (NULL), current_element (NULL),
char_data_buffer (NULL), implicit_default_namespace (false),
error_args (NULL),
- loader (NULL)
+ loader (NULL), created_elements (NULL)
{
namespace_map = g_hash_table_new (g_str_hash, g_str_equal);
}
~XamlParserInfo ()
{
+ created_elements = g_list_reverse (created_elements);
+ g_list_foreach (created_elements, unref_xaml_element, NULL);
+ g_list_free (created_elements);
+
if (char_data_buffer)
g_string_free (char_data_buffer, TRUE);
if (top_element)
@@ -743,9 +759,12 @@
g_hash_table_insert (p->namespace_map, g_strdup (uri),
x_namespace);
} else {
- if (!p->loader)
+ if (!p->loader) {
+ printf ("No loader.\n");
+ print_stack_trace ();
return parser_error (p, (p->current_element ?
p->current_element->element_name : NULL), prefix,
g_strdup_printf ("No custom element
callback installed to handle %s", uri));
+ }
CustomNamespace *c = new CustomNamespace (g_strdup (uri));
g_hash_table_insert (p->namespace_map, c->xmlns, c);
@@ -861,6 +880,8 @@
*element_type = Type::INVALID;
goto cleanup_and_return;
}
+
+ res->ref ();
}
cleanup_and_return:
@@ -934,6 +955,8 @@
*element_type = Type::INVALID;
goto cleanup_and_return;
}
+
+ res->ref ();
}
cleanup_and_return:
@@ -1224,6 +1247,7 @@
PathGeometry *pg = new PathGeometry ();
PathFigureCollection *pfc = new PathFigureCollection ();
pg->SetValue (PathGeometry::FiguresProperty, pfc);
+ pfc->unref ();
geometry_set_fill_rule (pg, FillRuleEvenOdd);
@@ -1245,12 +1269,15 @@
get_point (&cp1, &data);
if (relative) make_relative (&cp, &cp1);
- if (pf)
+ if (pf) {
pfc->Add (pf);
+ pf->unref ();
+ }
pf = new PathFigure ();
psc = new PathSegmentCollection ();
pf->SetValue (PathFigure::SegmentsProperty, psc);
+ psc->unref ();
pf->SetValue (PathFigure::StartPointProperty, Value
(cp1));
@@ -1268,6 +1295,7 @@
ls->SetValue (LineSegment::PointProperty, Value
(cp1));
psc->Add (ls);
+ ls->unref ();
prev = ls;
}
@@ -1299,6 +1327,7 @@
pls->SetValue (PolyLineSegment::PointsProperty,
Value (pts, count));
psc->Add (pls);
+ pls->unref ();
prev = pls;
cp.x = last.x;
@@ -1310,6 +1339,7 @@
ls->SetValue (LineSegment::PointProperty, Value
(cp1));
psc->Add (ls);
+ ls->unref ();
prev = ls;
cp.x = cp1.x;
@@ -1335,6 +1365,7 @@
ls->SetValue (LineSegment::PointProperty, Value (cp));
psc->Add (ls);
+ ls->unref ();
prev = ls;
break;
@@ -1355,6 +1386,7 @@
ls->SetValue (LineSegment::PointProperty, Value (cp));
psc->Add (ls);
+ ls->unref ();
prev = ls;
break;
@@ -1391,6 +1423,7 @@
pbs->SetValue
(PolyBezierSegment::PointsProperty, Value (pts, count));
psc->Add (pbs);
+ pbs->unref ();
prev = pbs;
cp.x = last.x;
@@ -1404,6 +1437,7 @@
bs->SetValue (BezierSegment::Point3Property,
Value (cp3));
psc->Add (bs);
+ bs->unref ();
prev = bs;
cp.x = cp3.x;
@@ -1449,6 +1483,7 @@
pbs->SetValue
(PolyBezierSegment::PointsProperty, Value (pts, count));
psc->Add (pbs);
+ pbs->unref ();
prev = pbs;
cp.x = last.x;
@@ -1462,6 +1497,7 @@
bs->SetValue (BezierSegment::Point3Property,
Value (cp3));
psc->Add (bs);
+ bs->unref ();
prev = bs;
cp.x = cp3.x;
@@ -1496,6 +1532,7 @@
pqbs->SetValue
(PolyQuadraticBezierSegment::PointsProperty, Value (pts, count));
psc->Add (pqbs);
+ pqbs->unref ();
prev = pqbs;
cp.x = last.x;
@@ -1508,6 +1545,7 @@
qbs->SetValue
(QuadraticBezierSegment::Point2Property, Value (cp2));
psc->Add (qbs);
+ qbs->unref ();
prev = qbs;
cp.x = cp2.x;
@@ -1546,6 +1584,7 @@
pqbs->SetValue
(PolyQuadraticBezierSegment::PointsProperty, Value (pts, count));
psc->Add (pqbs);
+ pqbs->unref ();
prev = pqbs;
cp.x = last.x;
@@ -1558,6 +1597,7 @@
qbs->SetValue
(QuadraticBezierSegment::Point2Property, Value (cp2));
psc->Add (qbs);
+ qbs->unref ();
prev = qbs;
cp.x = cp2.x;
@@ -1595,6 +1635,7 @@
arc->SetValue (ArcSegment::PointProperty, cp2);
psc->Add (arc);
+ arc->unref ();
prev = arc;
cp.x = cp2.x;
@@ -1619,8 +1660,10 @@
}
}
- if (pf)
+ if (pf) {
pfc->Add (pf);
+ pf->unref ();
+ }
return pg;
}
@@ -1856,8 +1899,10 @@
}
}
- if (!inst->item)
+ if (!inst->item) {
inst->item = i->create_item ();
+ p->AddCreatedElement (inst->item);
+ }
return inst;
}
@@ -1889,7 +1934,6 @@
Value *col_v = obj->GetValue (dep);
Collection *col = (Collection *) col_v->AsCollection ();
col->Add ((DependencyObject*)child->item);
- child->item->unref ();
return;
}
@@ -2046,7 +2090,7 @@
obj->SetValue (prop, Value (keytime_from_str (value)));
break;
case Type::KEYSPLINE:
- obj->SetValue (prop, Value (key_spline_from_str (value)));
+ obj->SetValue (prop, Value::CreateUnref (key_spline_from_str
(value)));
break;
case Type::BRUSH:
case Type::SOLIDCOLORBRUSH:
@@ -2057,6 +2101,7 @@
solid_color_brush_set_color (scb, c); // copies c
delete c;
obj->SetValue (prop, Value (scb));
+ scb->unref ();
break;
}
case Type::POINT:
@@ -2096,7 +2141,9 @@
break;
case Type::GEOMETRY:
{
- obj->SetValue (prop, geometry_from_str (value));
+ Geometry* geometry = geometry_from_str (value);
+ obj->SetValue (prop, geometry);
+ geometry->unref ();
break;
}
default:
@@ -2269,7 +2316,7 @@
dep->SetValue (prop, Value (keytime_from_str
(attr [i + 1])));
break;
case Type::KEYSPLINE:
- dep->SetValue (prop, Value (key_spline_from_str
(attr [i + 1])));
+ dep->SetValue (prop, Value::CreateUnref
(key_spline_from_str (attr [i + 1])));
break;
case Type::BRUSH:
case Type::SOLIDCOLORBRUSH:
@@ -2280,6 +2327,7 @@
solid_color_brush_set_color (scb, c); // copies
c
delete c;
dep->SetValue (prop, Value (scb));
+ scb->unref ();
}
break;
case Type::POINT:
@@ -2317,7 +2365,9 @@
break;
case Type::GEOMETRY:
{
- dep->SetValue (prop, geometry_from_str (attr [i
+ 1]));
+ Geometry* geometry = geometry_from_str (attr [i
+ 1]);
+ dep->SetValue (prop, geometry);
+ geometry->unref ();
}
break;
default:
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches