summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--raul/RDFNode.hpp3
-rw-r--r--src/RDFNode.cpp5
-rw-r--r--src/RDFWorld.cpp4
3 files changed, 10 insertions, 2 deletions
diff --git a/raul/RDFNode.hpp b/raul/RDFNode.hpp
index 63b7a2e..cdc103b 100644
--- a/raul/RDFNode.hpp
+++ b/raul/RDFNode.hpp
@@ -52,11 +52,12 @@ public:
librdf_node* get_node() const { return _node; }
- operator bool() const { return (_node != NULL); }
+ operator bool() const { return (_world != NULL && _node != NULL); }
const Node& operator=(const Node& other) {
if (_node)
librdf_free_node(_node);
+ _world = other._world;
_node = (other._node) ? librdf_new_node_from_node(other._node) : NULL;
return *this;
}
diff --git a/src/RDFNode.cpp b/src/RDFNode.cpp
index d70389e..4bc1fbb 100644
--- a/src/RDFNode.cpp
+++ b/src/RDFNode.cpp
@@ -43,6 +43,7 @@ Node::Node(World& world, Type type, const std::string& s)
}
assert(this->type() == type);
+ assert(_world);
}
@@ -51,6 +52,7 @@ Node::Node(World& world)
{
Glib::Mutex::Lock lock(world.mutex(), Glib::TRY_LOCK);
_node = librdf_new_node(world.world());
+ assert(_world);
}
@@ -59,6 +61,7 @@ Node::Node(World& world, librdf_node* node)
{
Glib::Mutex::Lock lock(world.mutex(), Glib::TRY_LOCK);
_node = librdf_new_node_from_node(node);
+ assert(_world);
}
@@ -70,6 +73,8 @@ Node::Node(const Node& other)
Glib::Mutex::Lock lock(_world->mutex(), Glib::TRY_LOCK);
_node = (other._node ? librdf_new_node_from_node(other._node) : NULL);
}
+
+ assert(to_string() == other.to_string());
}
diff --git a/src/RDFWorld.cpp b/src/RDFWorld.cpp
index d68919d..71a231c 100644
--- a/src/RDFWorld.cpp
+++ b/src/RDFWorld.cpp
@@ -87,7 +87,9 @@ World::blank_id()
{
std::ostringstream ss;
ss << "n" << _next_blank_id++;
- return Node(*this, Node::BLANK, ss.str());
+ Node result = Node(*this, Node::BLANK, ss.str());
+ assert(result.to_string() == ss.str());
+ return result;
}