OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace commits / 496b88a

Bug-fix PureExecLink
496b88a8a966890cd8e746413dfbb8eeefee3246
by Linas Vepštas <linasvepstas@gmail.com> · 2026-01-21T20:06:04.000Z

Changed files (1) +20 -15

opencog/atoms/parallel/PureExecLink.cc +20 -15
……@@ -64,6 +64,7 @@ ValuePtr PureExecLink::execute(AtomSpace* as,
6464{
6565 ValueSeq vseq;
6666 AtomSpace* ctxt = nullptr;
67 AtomSpacePtr scratch = nullptr;
6768 for (const Handle& h : _outgoing)
6869 {
6970 if (h->is_type(ATOM_SPACE))
……@@ -77,26 +78,30 @@ ValuePtr PureExecLink::execute(AtomSpace* as,
7778 vseq.push_back(h);
7879 continue;
7980 }
80 if (ctxt)
81
82 // If we don't have a context to run in, create a scratch space.
83 if (nullptr == ctxt)
8184 {
82 ValuePtr vp(h->execute(ctxt, silent));
83 // Should not really happen except it sometimes does:
84 // null pointers. Yuck. Oh well.
85 if (nullptr == vp)
86 continue;
85 scratch = createAtomSpace(as);
86 ctxt = scratch.get();
87 }
8788
88 // Special case. New context.
89 if (vp->is_type(ATOM_SPACE))
90 ctxt = AtomSpaceCast(vp).get();
89 ValuePtr vp(h->execute(ctxt, silent));
9190
92 vseq.emplace_back(vp);
91 // Should not really happen except it sometimes does:
92 // null pointers. Yuck. Oh well.
93 if (nullptr == vp)
9394 continue;
94 }
9595
96 // No AtomSpace provided. Use a temporary.
97 AtomSpacePtr scratch = createAtomSpace(as);
98 vseq.emplace_back(h->execute(scratch.get(), silent));
99 scratch->clear();
96 // Special case. New context.
97 if (vp->is_type(ATOM_SPACE))
98 ctxt = AtomSpaceCast(vp).get();
99
100 vseq.emplace_back(vp);
101
102 // If we are using a scratch space, clear it.
103 if (scratch.get() == ctxt)
104 scratch->clear();
100105 }
101106
102107 return createLinkValue(std::move(vseq));