tasks: make some UI code more robust against rare async edge cases
tasks: make some UI code more robust against rare async edge cases

sagemathinc/smc,tscholl2/smc,sagemathinc/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc,DrXyzzy/smc,sagemathinc/smc,DrXyzzy/smc,sagemathinc/smc