Prevent crash when deleting variant forms (LT-15042)

This apparently happens only on Windows, but the fix is safe for Linux.

Change-Id: I08ea1ea60fbb08c78ebd3aca43a92f1a087260d3