| … | … | @@ -50,6 +50,8 @@ typedef std::shared_ptr<AtomSpace> AtomSpacePtr; |
| 50 | 50 | class AtomSpace : public Frame |
| 51 | 51 | { |
| 52 | 52 | friend class StorageNode; // Needs to call add() directly. |
| 53 | template< class... Args > |
| 54 | friend AtomSpacePtr createAtomSpace(Args&&...); // Needs to call install() |
| 53 | 55 | |
| 54 | 56 | // Debug tools |
| 55 | 57 | static const bool EMIT_DIAGNOSTICS = true; |
| … | … | @@ -75,6 +77,7 @@ class AtomSpace : public Frame |
| 75 | 77 | // we keep two distinct lists to avoid the CPU overhead of casting |
| 76 | 78 | // between the two different pointer types (its significant). |
| 77 | 79 | std::vector<AtomSpacePtr> _environ; |
| 80 | void do_install(); |
| 78 | 81 | |
| 79 | 82 | void init(); |
| 80 | 83 | void clear_all_atoms(); |
| … | … | @@ -536,13 +539,7 @@ AtomSpacePtr createAtomSpace( Args&&... args ) |
| 536 | 539 | // Unfortunately, Frame::install() cannot be called in the ctor |
| 537 | 540 | // because shared_from_this() cannot be called in the ctor. |
| 538 | 541 | // So we do this after the ctor has finished. |
| 539 | | |
| 540 | | // XXX FIXME. I think this is installing into the wrong AtomSpace. |
| 541 | | // But no unit test seems to fail as a result of this, so I dunno. |
| 542 | | // But this can't be right, as written. |
| 543 | | asp->setAtomSpace(asp.get()); |
| 544 | | asp->install(); |
| 545 | | asp->setAtomSpace(nullptr); |
| 542 | asp->do_install(); |
| 546 | 543 | return asp; |
| 547 | 544 | } |
| 548 | 545 | |