Comment 4 for bug 1246245

Thanks Merlijn, your patch works. IMHO your patch is a good way to really fix the race condition.