OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace commits / 4d42014

Make sure that Atoms live somehwer, before execution.
4d420146ca1f2ba2bf4af9031dd0d487e44551a2
by Linas Vepštas <linasvepstas@gmail.com> · 2026-01-21T01:52:05.000Z

Changed files (1) +15 -2

opencog/atomspace/AtomSpace.cc +15 -2
……@@ -119,21 +119,34 @@ AtomSpace::~AtomSpace()
119119 clear_all_atoms();
120120}
121121
122// Set up a vector points to the parent AtomSpaces.
122/// Set up a vector of pointers to the parent AtomSpaces.
123123void AtomSpace::do_install(void)
124124{
125125 if (0 == _environ.size())
126126 {
127127 for (const Handle& base : _outgoing)
128128 {
129 // Easy. Just copy cast.
129130 if (_nameserver.isA(base->get_type(), ATOM_SPACE))
130131 {
131132 _environ.push_back(AtomSpaceCast(base));
132133 continue;
133134 }
135
136 // The provided Atom in the outgoing set might be
137 // executable and so we need to execute it, and
138 // hopefully get an AtomSpace back. The only tricky
139 // part here is that we might have been called from
140 // Sexpr::decode_atom(), and so `base` might not be
141 // in any AtomSpace, yet(!) So we put it in this one.
142 // Duhh. Just like everything else in the world.
134143 if (base->is_executable())
135144 {
136 ValuePtr vp(base->execute());
145 Handle bh(base);
146 if (nullptr == base->getAtomSpace())
147 bh = this->add_atom(base);
148
149 ValuePtr vp(bh->execute(this));
137150 AtomSpacePtr as(AtomSpaceCast(vp));
138151 if (nullptr == as)
139152 throw RuntimeException(TRACE_INFO,