Skip to content

Commit

Permalink
Added debugging. Still crashes, but now I can see why. The Root vn is…
Browse files Browse the repository at this point in the history
… being destroyed before canvastreestore.cpp gets to use it.
  • Loading branch information
Chris Moore committed Jan 4, 2009
1 parent 0a71d8d commit 0b4167c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
25 changes: 24 additions & 1 deletion synfig-core/trunk/src/synfig/valuenode_bone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ ValueNode_Bone::get_animated_matrix(Time t, Real scale, Angle rotate, Point tran
ValueNode_Bone::ConstHandle
ValueNode_Bone::get_parent(Time t)const
{
printf("%s:%d get_parent\n", __FILE__, __LINE__);
// check if we are an ancestor of the proposed parent
ValueNode_Bone::ConstHandle parent((*parent_)(t).get(ValueNode_Bone::Handle()));
if (ValueNode_Bone::ConstHandle result = is_ancestor_of(parent,t))
Expand All @@ -284,14 +285,19 @@ ValueNode_Bone::get_parent(Time t)const
synfig::error("A bone cannot be parent of itself or any of its descendants");
else
synfig::error("A loop was detected in the ancestry at bone %s", GET_NODE_DESC_CSTR(result,t));
printf("%s:%d root 1\n", __FILE__, __LINE__);
return new ValueNode_Bone_Root;
}

// proposed parent is root or not a descendant of current bone
if (parent)
{
printf("%s:%d parent\n", __FILE__, __LINE__);
return parent;
}

return new ValueNode_Bone_Root;
printf("%s:%d root 2\n", __FILE__, __LINE__);
return ValueNode_Bone::ConstHandle::cast_dynamic(new ValueNode_Bone_Root);
}

ValueBase
Expand Down Expand Up @@ -833,6 +839,23 @@ ValueNode_Bone::runref()const
}
#endif

ValueNode_Bone_Root::ValueNode_Bone_Root():
ValueNode_Bone(ValueBase::TYPE_BONE)
{
printf("%s:%d ValueNode_Bone_Root::ValueNode_Bone_Root()\n", __FILE__, __LINE__);
}

ValueNode_Bone_Root::ValueNode_Bone_Root(const ValueBase &value):
ValueNode_Bone(value.get_type())
{
printf("%s:%d ValueNode_Bone_Root::ValueNode_Bone_Root(value)\n", __FILE__, __LINE__);
}

ValueNode_Bone_Root::~ValueNode_Bone_Root()
{
printf("%s:%d ValueNode_Bone_Root::~ValueNode_Bone_Root()\n", __FILE__, __LINE__);
}

String
ValueNode_Bone_Root::get_name()const
{
Expand Down
5 changes: 3 additions & 2 deletions synfig-core/trunk/src/synfig/valuenode_bone.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ class ValueNode_Bone_Root : public ValueNode_Bone
virtual String get_name()const;
virtual String get_local_name()const;

ValueNode_Bone_Root():ValueNode_Bone(ValueBase::TYPE_BONE){ }
ValueNode_Bone_Root(const ValueBase &value):ValueNode_Bone(value.get_type()){ }
ValueNode_Bone_Root();
ValueNode_Bone_Root(const ValueBase &value);
virtual ~ValueNode_Bone_Root();
virtual int link_count()const;

private:
Expand Down
8 changes: 8 additions & 0 deletions synfig-studio/trunk/src/gtkmm/canvastreestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ CanvasTreeStore::get_value_vfunc(const Gtk::TreeModel::iterator& iter, int colum
Time time(canvas_interface()->get_time());
Bone bone((*(value_desc.get_value_node()))(time).get(Bone()));
String display(String(bone.get_name()));
printf("%s:%d\n", __FILE__, __LINE__);
printf("%lx\n", ulong(bone.get_parent()));
printf("%s:%d\n", __FILE__, __LINE__);
ValueNode::ConstHandle parent(bone.get_parent());
printf("%s:%d\n", __FILE__, __LINE__);
printf("%lx\n", ulong(parent.get()));
printf("%s:%d\n", __FILE__, __LINE__);
if (ValueNode_Bone::ConstHandle parent = bone.get_parent())
if (ValueNode_Bone::ConstHandle parent = bone.get_parent())
display += " --> " + String((*parent->get_link("name"))(time).get(String()));
x.set(display);
Expand Down

0 comments on commit 0b4167c

Please sign in to comment.