Using RAII to remedy a defect where not all code paths performed required exit actions

A team asked me to review their pull request that fixed a bug that was caused by failing to perform some required action along all code paths. Here’s a simplified sketch: void MySpecialFeature::OnButtonClick() { try { auto file = PickFile(); if (!file) { DismissUI(); return;

Click here to read the article