summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2011-11-05 07:20:36 +0000
committerKris <Kris.De.Gussem@hotmail.com>2011-11-05 07:20:36 +0000
commit7b1b14913ac759e86176d212afa6d90f67eb8bb6 (patch)
tree6c76923a97854c7ae6c24ee4e352e4b413d9a909 /src
parent1) Cycle to the next-closest-snap-source when pressing tab, if the snap-close... (diff)
downloadinkscape-7b1b14913ac759e86176d212afa6d90f67eb8bb6.tar.gz
inkscape-7b1b14913ac759e86176d212afa6d90f67eb8bb6.zip
Various fixes: initialization, memory leak, wrong iterator usage
(bzr r10721)
Diffstat (limited to 'src')
-rw-r--r--src/composite-undo-stack-observer.cpp14
-rw-r--r--src/dom/views.h19
-rw-r--r--src/snap-candidate.h2
3 files changed, 23 insertions, 12 deletions
diff --git a/src/composite-undo-stack-observer.cpp b/src/composite-undo-stack-observer.cpp
index 383e08cd8..81a0b27c7 100644
--- a/src/composite-undo-stack-observer.cpp
+++ b/src/composite-undo-stack-observer.cpp
@@ -137,16 +137,22 @@ CompositeUndoStackObserver::_unlock()
if (!--this->_iterating) {
// Remove marked observers
UndoObserverRecordList::iterator i = this->_active.begin();
- for(; i != this->_active.begin(); ++i) {
+ for(; i != this->_active.begin(); ) {
if (i->to_remove) {
- this->_active.erase(i);
+ i = this->_active.erase(i);
+ }
+ else{
+ ++i;
}
}
i = this->_pending.begin();
- for(; i != this->_pending.begin(); ++i) {
+ for(; i != this->_pending.begin(); ) {
if (i->to_remove) {
- this->_active.erase(i);
+ i = this->_active.erase(i);
+ }
+ else {
+ ++i;
}
}
diff --git a/src/dom/views.h b/src/dom/views.h
index 48afd5d16..f165d2a9b 100644
--- a/src/dom/views.h
+++ b/src/dom/views.h
@@ -125,12 +125,14 @@ public:
private:
void assign(const AbstractView &other)
+ {
+ if (documentView != NULL)
{
+ free(documentView); //NOTE: is free the correct method?
+ }
documentView = other.documentView;
- }
-
- DocumentView *documentView;
-
+ }
+ DocumentView *documentView;
};
@@ -163,7 +165,7 @@ public:
/**
*
*/
- DocumentView() {}
+ DocumentView() {defaultView = NULL;}
/**
*
@@ -190,10 +192,13 @@ public:
private:
void assign(const DocumentView &other)
+ {
+ if (defaultView != NULL)
{
+ free(defaultView); //NOTE: is free the correct method?
+ }
defaultView = other.defaultView;
- }
-
+ }
AbstractView *defaultView;
};
diff --git a/src/snap-candidate.h b/src/snap-candidate.h
index 857a2c2a4..1c5cf3234 100644
--- a/src/snap-candidate.h
+++ b/src/snap-candidate.h
@@ -73,7 +73,7 @@ public:
void setSourceNum(long num) {_source_num = num;}
void setDistance(Geom::Coord dist) {_dist = dist;}
Geom::Coord getDistance() { return _dist;}
- bool operator <(const SnapCandidatePoint other) const { return _dist < other._dist; } // Needed for sorting the SnapCandidatePoints
+ bool operator <(const SnapCandidatePoint &other) const { return _dist < other._dist; } // Needed for sorting the SnapCandidatePoints
inline Geom::OptRect const getTargetBBox() const {return _target_bbox;}
boost::optional<Geom::Point> const & getStartingPoint() const {return _line_starting_point;}