diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-06-19 00:29:52 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-06-19 00:29:52 +0000 |
| commit | fd8dc80e78f402e37d9c4ef29094e69d90653ea6 (patch) | |
| tree | a858ce047096b8ddb581d76805760e773a251a5f /src/xml | |
| parent | Removed original path helper paths pointed by LiamW (diff) | |
| parent | add win64 files to distribution (Makefile.am) (diff) | |
| download | inkscape-fd8dc80e78f402e37d9c4ef29094e69d90653ea6.tar.gz inkscape-fd8dc80e78f402e37d9c4ef29094e69d90653ea6.zip | |
Update to latest tip (trunk r13432)
(bzr r13341.1.62)
Diffstat (limited to 'src/xml')
| -rw-r--r-- | src/xml/helper-observer.cpp | 13 | ||||
| -rw-r--r-- | src/xml/helper-observer.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp index c54dd8e74..957f3df0a 100644 --- a/src/xml/helper-observer.cpp +++ b/src/xml/helper-observer.cpp @@ -5,25 +5,34 @@ namespace XML { // Very simple observer that just emits a signal if anything happens to a node SignalObserver::SignalObserver() - : _oldsel(0) + : _oldsel(NULL) {} +SignalObserver::~SignalObserver() +{ + set(NULL); // if _oldsel!=nullptr, remove observer and decrease refcount +} + // Add this observer to the SPObject and remove it from any previous object 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*) diff --git a/src/xml/helper-observer.h b/src/xml/helper-observer.h index e7881cd4d..2f70ba792 100644 --- a/src/xml/helper-observer.h +++ b/src/xml/helper-observer.h @@ -17,6 +17,7 @@ namespace Inkscape { { public: SignalObserver(); + ~SignalObserver(); // Add this observer to the SPObject and remove it from any previous object void set(SPObject* o); |
