Fixed #4385: lock_guard RAII throws unreadVariable