Skip to content

Commit cc5c95e

Browse files
Anton Erikssondanieledler
andcommitted
fix(python): Segfault when accessing physical_nodes
Closes #300 Co-authored-by: Daniel Edler <danieledler@users.noreply.github.com>
1 parent ecc0292 commit cc5c95e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/core/iterators/InfomapIterator.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,15 @@ struct InfomapIteratorPhysical : public InfomapIterator {
203203
InfomapIteratorPhysical(InfoNode* nodePointer, int moduleIndexLevel = -1)
204204
: InfomapIterator(nodePointer, moduleIndexLevel) { }
205205

206-
InfomapIteratorPhysical(const InfomapIterator& other) : InfomapIterator(other) { }
207-
208206
~InfomapIteratorPhysical() override = default;
209207
InfomapIteratorPhysical(const InfomapIteratorPhysical&) = default;
210-
InfomapIteratorPhysical& operator=(const InfomapIteratorPhysical&) = default;
208+
InfomapIteratorPhysical(const InfomapIterator& other) : InfomapIterator(other) { }
209+
211210
InfomapIteratorPhysical(InfomapIteratorPhysical&&) = default;
212-
InfomapIteratorPhysical& operator=(InfomapIteratorPhysical&&) = default;
211+
InfomapIteratorPhysical& operator=(const InfomapIteratorPhysical&) = default;
212+
213+
// Don't allow moving from this iterator as we use the old iterator in operator++
214+
InfomapIteratorPhysical& operator=(InfomapIteratorPhysical&&) = delete;
213215

214216
InfomapIteratorPhysical& operator=(const InfomapIterator& other)
215217
{
@@ -249,9 +251,11 @@ struct InfomapLeafIteratorPhysical : public InfomapIteratorPhysical {
249251
: InfomapIteratorPhysical(other) { init(); }
250252

251253
~InfomapLeafIteratorPhysical() override = default;
252-
InfomapLeafIteratorPhysical& operator=(const InfomapLeafIteratorPhysical&) = default;
253254
InfomapLeafIteratorPhysical(InfomapLeafIteratorPhysical&&) = default;
254-
InfomapLeafIteratorPhysical& operator=(InfomapLeafIteratorPhysical&&) = default;
255+
InfomapLeafIteratorPhysical& operator=(const InfomapLeafIteratorPhysical&) = default;
256+
257+
// Don't allow moving from this iterator as we use the old iterator in operator++
258+
InfomapLeafIteratorPhysical& operator=(InfomapLeafIteratorPhysical&&) = delete;
255259

256260
/**
257261
* Iterate to first leaf node

0 commit comments

Comments
 (0)