race in Future destructor
race in Future destructor

Summary:
@mnd wrote some Wangle code that would trip up with a `bad_function_call` exception. This Shouldn't Happen™ but the exception comes from trying to call a `std::function` which is null. We pretty thoroughly examined his usage and didn't find any problems, and this patch seems to make the error go away. See #4207781 for more details.

And reasoning about it, it makes sense. Inline comments explain the race.

Test Plan: Alas, I haven't been able to get a minimal repro and therefore a regression unit test. It's a hard race to trigger. I still don't understand why Matt's code does it.

Reviewed By: davejwatson@fb.com

FB internal diff: D1304001


PPC64/folly,tempbottle/folly,clearlylin/folly,rklabs/folly,Hincoin/folly,cole14/folly,doctaweeks/folly,bikong2/folly,CJstar/folly,bikong2/folly,gavioto/folly,bikong2/folly,arg0/folly,tomhughes/folly,SeanRBurton/folly,fw1121/folly,PoisonBOx/folly,Hincoin/folly,zhiweicai/folly,fw1121/folly,leolujuyi/folly,leolujuyi/folly,upsoft/folly,xzmagic/folly,bobegir/folly,upsoft/folly,yangjin-unique/folly,mqeizi/folly,SammyK/folly,juniway/folly,cppfool/folly,wildinto/folly,nickhen/folly,reddit/folly,arg0/folly,zhiweicai/folly,wildinto/folly,kernelim/folly,constantine001/folly,renyinew/folly,stonegithubs/folly,tempbottle/folly,ykarlsbrun/folly,Eagle-X/folly,cole14/folly,guker/folly,ykarlsbrun/folly,raphaelamorim/folly,rklabs/folly,guker/folly,hongliangzhao/folly,stonegithubs/folly,cppfool/folly,sakishum/folly,renyinew/folly,sakishum/folly,Eagle-X/folly,clearlinux/folly,yangjin-unique/folly,reddit/folly,leolujuyi/folly,arg0/folly,cole14/folly,nickhen/folly,wildinto/folly,romange/folly,renyinew/folly,guker/folly,bowlofstew/folly,wildinto/folly,leolujuyi/folly,PoisonBOx/folly,bobegir/folly,shaobz/folly,constantine001/folly,theiver9827/folly,facebook/folly,kernelim/folly,cppfool/folly,sonnyhu/folly,Eagle-X/folly,clearlylin/folly,bsampath/folly,mqeizi/folly,PoisonBOx/folly,clearlinux/folly,SeanRBurton/folly,PoisonBOx/folly,alexst07/folly,sakishum/folly,bikong2/folly,sonnyhu/folly,nickhen/folly,KSreeHarsha/folly,zhiweicai/folly,facebook/folly,rklabs/folly,mqeizi/folly,ykarlsbrun/folly,Eagle-X/folly,charsyam/folly,stonegithubs/folly,bobegir/folly,mqeizi/folly,lifei/folly,sonnyhu/folly,bsampath/folly,brunomorishita/folly,CJstar/folly,PPC64/folly,loverszhaokai/folly,theiver9827/folly,tomhughes/folly,colemancda/folly,nickhen/folly,raphaelamorim/folly,bsampath/folly,ykarlsbrun/folly,Hincoin/folly,gaoyingie/folly,tomhughes/folly,juniway/folly,loversInJapan/folly,doctaweeks/folly,zhiweicai/folly,leolujuyi/folly,floxard/folly,project-zerus/folly,yangjin-unique/folly,project-zerus/folly,CJstar/folly,raphaelamorim/folly,colemancda/folly,arg0/folly,xzmagic/folly,sakishum/folly,xzmagic/folly,clearlinux/folly,cppfool/folly,theiver9827/folly,gaoyingie/folly,Hincoin/folly,colemancda/folly,SammyK/folly,shaobz/folly,mqeizi/folly,SeanRBurton/folly,bsampath/folly,theiver9827/folly,brunomorishita/folly,upsoft/folly,Orvid/folly,loverszhaokai/folly,juniway/folly,romange/folly,SammyK/folly,SeanRBurton/folly,tempbottle/folly,tempbottle/folly,guker/folly,clearlylin/folly,ykarlsbrun/folly,alexst07/folly,hongliangzhao/folly,cppfool/folly,theiver9827/folly,PPC64/folly,gavioto/folly,PPC64/folly,loverszhaokai/folly,juniway/folly,gaoyingie/folly,charsyam/folly,PoisonBOx/folly,project-zerus/folly,bobegir/folly,Eagle-X/folly,lifei/folly,fw1121/folly,yangjin-unique/folly,Hincoin/folly,raphaelamorim/folly,doctaweeks/folly,alexst07/folly,charsyam/folly,loverszhaokai/folly,cole14/folly,constantine001/folly,Orvid/folly,lifei/folly,kernelim/folly,bikong2/folly,colemancda/folly,PPC64/folly,alexst07/folly,renyinew/folly,juniway/folly,guker/folly,tomhughes/folly,project-zerus/folly,fw1121/folly,reddit/folly,nickhen/folly,loversInJapan/folly,sakishum/folly,wildinto/folly,reddit/folly,kernelim/folly,SammyK/folly,bowlofstew/folly,constantine001/folly,lifei/folly,doctaweeks/folly,kernelim/folly,loversInJapan/folly,gaoyingie/folly,Orvid/folly,lifei/folly,shaobz/folly,SammyK/folly,chjp2046/folly,CJstar/folly,chjp2046/folly,xzmagic/folly,constantine001/folly,arg0/folly,brunomorishita/folly,facebook/folly,loverszhaokai/folly,doctaweeks/folly,alexst07/folly,KSreeHarsha/folly,bobegir/folly,hongliangzhao/folly,bsampath/folly,gavioto/folly,SeanRBurton/folly,KSreeHarsha/folly,cole14/folly,facebook/folly,shaobz/folly,reddit/folly,zhiweicai/folly,clearlinux/folly,raphaelamorim/folly,stonegithubs/folly,romange/folly,loversInJapan/folly,renyinew/folly,facebook/folly,gavioto/folly,floxard/folly,chjp2046/folly,hongliangzhao/folly,floxard/folly,clearlylin/folly,loversInJapan/folly,romange/folly,tomhughes/folly,upsoft/folly,chjp2046/folly,fw1121/folly,rklabs/folly,sonnyhu/folly,tempbottle/folly,KSreeHarsha/folly,bowlofstew/folly,romange/folly,stonegithubs/folly,floxard/folly,xzmagic/folly,hongliangzhao/folly,yangjin-unique/folly,clearlinux/folly,Orvid/folly,brunomorishita/folly,rklabs/folly,chjp2046/folly,floxard/folly,project-zerus/folly,Orvid/folly,CJstar/folly,colemancda/folly,upsoft/folly,clearlylin/folly,gaoyingie/folly,sonnyhu/folly,gavioto/folly,shaobz/folly,bowlofstew/folly,charsyam/folly,bowlofstew/folly,KSreeHarsha/folly,brunomorishita/folly