summaryrefslogtreecommitdiffstats
path: root/src/xml/helper-observer.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-06-15 23:02:03 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-06-15 23:02:03 +0000
commit72c8020b8036c0f4dce9ce6c0e269a29624ed6f2 (patch)
treea84b79fd5b4961418682695ea28e90059a1fe24e /src/xml/helper-observer.cpp
parentAllow symbol zooming independent of icon screen size. (diff)
downloadinkscape-72c8020b8036c0f4dce9ce6c0e269a29624ed6f2.tar.gz
inkscape-72c8020b8036c0f4dce9ce6c0e269a29624ed6f2.zip
add proper refcounting to XML SignalObserver. not refcounting caused crash upon opening Filter Editor dialog for the first time with a filtered object selected.
Fixed bugs: - https://launchpad.net/bugs/1328152 (bzr r13426)
Diffstat (limited to 'src/xml/helper-observer.cpp')
-rw-r--r--src/xml/helper-observer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp
index c54dd8e74..e56ddc6f8 100644
--- a/src/xml/helper-observer.cpp
+++ b/src/xml/helper-observer.cpp
@@ -5,7 +5,7 @@ namespace XML {
// Very simple observer that just emits a signal if anything happens to a node
SignalObserver::SignalObserver()
- : _oldsel(0)
+ : _oldsel(NULL)
{}
// Add this observer to the SPObject and remove it from any previous object
@@ -13,17 +13,21 @@ void SignalObserver::set(SPObject* o)
{
// XML Tree being used direcly in this function in the following code
// while it shouldn't be
+ // Pointer to object is stored, so refcounting should be increased/decreased
if(_oldsel) {
if (_oldsel->getRepr()) {
_oldsel->getRepr()->removeObserver(*this);
}
+ sp_object_unref(_oldsel);
+ _oldsel = NULL;
}
if(o) {
if (o->getRepr()) {
o->getRepr()->addObserver(*this);
+ sp_object_ref(o);
+ _oldsel = o;
}
}
- _oldsel = o;
}
void SignalObserver::notifyChildAdded(XML::Node&, XML::Node&, XML::Node*)