Handle branching unlock conditions.

This recreates the RAII unwinding that was achieved implicitly using unique_ptr.