Ref T8198. Currently, if you swap a write guard like this:
$write_guard->dispose(); $write_guard = new AphrontWriteGuard('callback');
...the second line does this:
- Creates a new WriteGuard object.
- Assigns it to self::$instance.
- Invokes __destroy() on the old object.
At this point, we'll throw an exception, even though we disposed of the write guard properly.
Instead, flag write guard disposal explicitly to prevent this issue.