My Friday fix for some stack trashing introduced some heap trashing! The tests create PageInterstitial objects which are self-owned (they delete themselves when hidden). The tests test whether the PageInterstitial instance has been deleted by passing a local variable boolean to its constructor that the InterstitialPage sets to true when deleted.
My Friday fix for some stack trashing introduced some heap trashing!
The tests create PageInterstitial objects which are self-owned (they delete themselves when hidden).
The tests test whether the PageInterstitial instance has been deleted by passing a local variable boolean to its constructor that the InterstitialPage sets to true when deleted.

In the stack trashing case, in one of the test the interstitial was deleted from the TearDown() method, so outside of the scope of the test. The interstitial was still accessing the local variable from the test scope, trashing the stack.
My previous fix introduced a state guard class allocated on the stack that would notify the InterstitialPage when deleted so it would clear any reference to the local vars, which fixed the stack trashing.
But this created a new problem: when the interstitial is deleted in the scope of the unit tests, the state guard object still holds a reference to the now deleted interstitial and calls a method on it when itself deleted.

This CL ensures the state guard class does not access any deleted interstitial.

BUG=5789


Review URL: http://codereview.chromium.org/16423

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@7384 0039d316-1c4b-4281-b951-d872f2087c98

fujunwei/chromium-crosswalk,ltilve/chromium,ondra-novak/chromium.src,Just-D/chromium-1,keishi/chromium,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,hujiajie/pa-chromium,junmin-zhu/chromium-rivertrail,keishi/chromium,pozdnyakov/chromium-crosswalk,dednal/chromium.src,robclark/chromium,crosswalk-project/chromium-crosswalk-efl,hujiajie/pa-chromium,dushu1203/chromium.src,chuan9/chromium-crosswalk,dednal/chromium.src,hgl888/chromium-crosswalk,patrickm/chromium.src,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,Fireblend/chromium-crosswalk,ltilve/chromium,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,markYoungH/chromium.src,hgl888/chromium-crosswalk-efl,littlstar/chromium.src,jaruba/chromium.src,zcbenz/cefode-chromium,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,jaruba/chromium.src,patrickm/chromium.src,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,ltilve/chromium,Jonekee/chromium.src,mogoweb/chromium-crosswalk,dednal/chromium.src,dushu1203/chromium.src,M4sse/chromium.src,Just-D/chromium-1,Fireblend/chromium-crosswalk,robclark/chromium,patrickm/chromium.src,hgl888/chromium-crosswalk,M4sse/chromium.src,crosswalk-project/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,dushu1203/chromium.src,junmin-zhu/chromium-rivertrail,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk-efl,anirudhSK/chromium,nacl-webkit/chrome_deps,patrickm/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,zcbenz/cefode-chromium,ltilve/chromium,Pluto-tv/chromium-crosswalk,rogerwang/chromium,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,markYoungH/chromium.src,mogoweb/chromium-crosswalk,patrickm/chromium.src,timopulkkinen/BubbleFish,zcbenz/cefode-chromium,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Jonekee/chromium.src,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacewalk,Jonekee/chromium.src,Fireblend/chromium-crosswalk,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,littlstar/chromium.src,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,robclark/chromium,ltilve/chromium,junmin-zhu/chromium-rivertrail,keishi/chromium,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,M4sse/chromium.src,TheTypoMaster/chromium-crosswalk,keishi/chromium,Chilledheart/chromium,zcbenz/cefode-chromium,bright-sparks/chromium-spacewalk,Fireblend/chromium-crosswalk,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,ChromiumWebApps/chromium,dednal/chromium.src,anirudhSK/chromium,M4sse/chromium.src,fujunwei/chromium-crosswalk,hujiajie/pa-chromium,dednal/chromium.src,krieger-od/nwjs_chromium.src,M4sse/chromium.src,keishi/chromium,Fireblend/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,patrickm/chromium.src,dednal/chromium.src,robclark/chromium,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,Chilledheart/chromium,nacl-webkit/chrome_deps,markYoungH/chromium.src,Chilledheart/chromium,jaruba/chromium.src,junmin-zhu/chromium-rivertrail,fujunwei/chromium-crosswalk,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,pozdnyakov/chromium-crosswalk,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,zcbenz/cefode-chromium,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,littlstar/chromium.src,dednal/chromium.src,axinging/chromium-crosswalk,rogerwang/chromium,nacl-webkit/chrome_deps,bright-sparks/chromium-spacewalk,anirudhSK/chromium,zcbenz/cefode-chromium,dednal/chromium.src,ChromiumWebApps/chromium,ondra-novak/chromium.src,mohamed--abdel-maksoud/chromium.src,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,Just-D/chromium-1,axinging/chromium-crosswalk,hujiajie/pa-chromium,chuan9/chromium-crosswalk,rogerwang/chromium,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,patrickm/chromium.src,keishi/chromium,bright-sparks/chromium-spacewalk,keishi/chromium,axinging/chromium-crosswalk,rogerwang/chromium,littlstar/chromium.src,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,robclark/chromium,Jonekee/chromium.src,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,PeterWangIntel/chromium-crosswalk,ondra-novak/chromium.src,nacl-webkit/chrome_deps,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacewalk,Just-D/chromium-1,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,Jonekee/chromium.src,hujiajie/pa-chromium,chuan9/chromium-crosswalk,hujiajie/pa-chromium,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,mogoweb/chromium-crosswalk,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk-efl,timopulkkinen/BubbleFish,PeterWangIntel/chromium-crosswalk,fujunwei/chromium-crosswalk,robclark/chromium,anirudhSK/chromium,M4sse/chromium.src,mogoweb/chromium-crosswalk,ltilve/chromium,bright-sparks/chromium-spacewalk,anirudhSK/chromium,dushu1203/chromium.src,Just-D/chromium-1,ChromiumWebApps/chromium,hujiajie/pa-chromium,hgl888/chromium-crosswalk,zcbenz/cefode-chromium,Chilledheart/chromium,littlstar/chromium.src,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,keishi/chromium,bright-sparks/chromium-spacewalk,Chilledheart/chromium,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,nacl-webkit/chrome_deps,rogerwang/chromium,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,jaruba/chromium.src,markYoungH/chromium.src,ondra-novak/chromium.src,markYoungH/chromium.src,rogerwang/chromium,nacl-webkit/chrome_deps,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,ondra-novak/chromium.src,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,junmin-zhu/chromium-rivertrail,timopulkkinen/BubbleFish,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,littlstar/chromium.src,keishi/chromium,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,keishi/chromium,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,chuan9/chromium-crosswalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,zcbenz/cefode-chromium,anirudhSK/chromium,anirudhSK/chromium,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,mohamed--abdel-maksoud/chromium.src,nacl-webkit/chrome_deps,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,Jonekee/chromium.src,Jonekee/chromium.src,dednal/chromium.src,markYoungH/chromium.src,patrickm/chromium.src,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,krieger-od/nwjs_chromium.src,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk,Chilledheart/chromium,markYoungH/chromium.src,Just-D/chromium-1,timopulkkinen/BubbleFish,Just-D/chromium-1,Chilledheart/chromium,keishi/chromium,ChromiumWebApps/chromium,Just-D/chromium-1,littlstar/chromium.src,Fireblend/chromium-crosswalk,Chilledheart/chromium,ChromiumWebApps/chromium,robclark/chromium,ondra-novak/chromium.src,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,junmin-zhu/chromium-rivertrail,M4sse/chromium.src,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,robclark/chromium,dednal/chromium.src,dushu1203/chromium.src,anirudhSK/chromium,M4sse/chromium.src,markYoungH/chromium.src,rogerwang/chromium,ChromiumWebApps/chromium,Jonekee/chromium.src,rogerwang/chromium,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,robclark/chromium,nacl-webkit/chrome_deps,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,anirudhSK/chromium,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,robclark/chromium,hujiajie/pa-chromium,Jonekee/chromium.src,jaruba/chromium.src,rogerwang/chromium,junmin-zhu/chromium-rivertrail,mogoweb/chromium-crosswalk,anirudhSK/chromium,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,zcbenz/cefode-chromium,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,nacl-webkit/chrome_deps,ChromiumWebApps/chromium,pozdnyakov/chromium-crosswalk,axinging/chromium-crosswalk,mogoweb/chromium-crosswalk,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,ltilve/chromium,timopulkkinen/BubbleFish