diff --git a/pl/corout.yap b/pl/corout.yap index 8370c40bb..a81f00829 100644 --- a/pl/corout.yap +++ b/pl/corout.yap @@ -522,6 +522,10 @@ frozen(V, LG) :- '$purge_done_goals'(G0, GF). '$purge_done_goals'(['$redo_freeze'(Done, _, _)|G0], GF) :- nonvar(Done), !, '$purge_done_goals'(G0, GF). +'$purge_done_goals'(['$redo_freeze'(Done, _, CallCleanup)|G0], GF) :- + nonvar(CallCleanup), + CallCleanup = _:'$clean_call'(_), !, + '$purge_done_goals'(G0, GF). '$purge_done_goals'(['$redo_eq'(Done, _, _, _)|G0], GF) :- nonvar(Done), !, '$purge_done_goals'(G0, GF). '$purge_done_goals'(['$redo_ground'(Done, _, _)|G0], GF) :- nonvar(Done), !, diff --git a/pl/utils.yap b/pl/utils.yap index 0170030b2..d0be525b2 100644 --- a/pl/utils.yap +++ b/pl/utils.yap @@ -189,8 +189,7 @@ call_cleanup(Goal, Cleanup) :- call_cleanup(Goal, Catcher, Cleanup) :- catch('$call_cleanup'(Goal,Cleanup,Result), Exception, - '$cleanup_exception'(Exception,Catcher,Cleanup)), - Result = exit. + '$cleanup_exception'(Exception,Catcher,Cleanup)). '$cleanup_exception'(Exception, exception(Exception), Cleanup) :- call(Cleanup). @@ -205,7 +204,8 @@ call_cleanup(Goal, Catcher, Cleanup) :- Result = exit, ! ; true ) - ; Result = fail + ; Result = fail, + fail ). '$clean_call'(Cleanup) :-