| … | … | @@ -89,6 +89,7 @@ ValuePtr PureExecLink::execute(AtomSpace* as, |
| 89 | 89 | if (nullptr == ctxt) |
| 90 | 90 | { |
| 91 | 91 | scratch = createAtomSpace(as); |
| 92 | scratch->set_copy_on_write(); |
| 92 | 93 | ctxt = scratch.get(); |
| 93 | 94 | } |
| 94 | 95 | |
| … | … | @@ -110,6 +111,15 @@ ValuePtr PureExecLink::execute(AtomSpace* as, |
| 110 | 111 | scratch->clear(); |
| 111 | 112 | } |
| 112 | 113 | |
| 114 | // The scratch space got placed into the parent. Remove it. |
| 115 | // Force a recursive remove, in case even more spaces got |
| 116 | // placed in there. (Does recursive remove for AtomSpaces work??) |
| 117 | if (scratch.get()) |
| 118 | { |
| 119 | scratch->clear(); |
| 120 | as->remove_atom(HandleCast(scratch), true); |
| 121 | } |
| 122 | |
| 113 | 123 | // Sop to the user. If only one item, return that one item. |
| 114 | 124 | // This feels both hacky, and also reasonable. The hacky |
| 115 | 125 | // feeling is that it behaves differently, based on size. Yuck. |