[scenic] Fix ASan use-after-free.

The EventTimestamper continues to try to use the app_context_ even
though it is freed at the end of CompositorTest::CreateSessionContext.

Test: Ran through ASan bot; formerly failing test does not fail.

Change-Id: Ic6997dc1db642ee452414f29bc31ccbae7e6336d
diff --git a/garnet/lib/ui/gfx/tests/compositor_unittest.cc b/garnet/lib/ui/gfx/tests/compositor_unittest.cc
index 40467c7..037fb45 100644
--- a/garnet/lib/ui/gfx/tests/compositor_unittest.cc
+++ b/garnet/lib/ui/gfx/tests/compositor_unittest.cc
@@ -41,8 +41,8 @@
 
     // Generate other parameters needed for session context.
     sys::testing::ComponentContextProvider context_provider_;
-    auto app_context = context_provider_.TakeContext();
-    time_stamper_ = std::make_unique<EventTimestamper>(app_context.get());
+    app_context_ = context_provider_.TakeContext();
+    time_stamper_ = std::make_unique<EventTimestamper>(app_context_.get());
     resource_linker_ = std::make_unique<ResourceLinker>();
     view_linker_ = std::make_unique<ViewLinker>();
 
@@ -63,6 +63,9 @@
   std::unique_ptr<EventTimestamper> time_stamper_;
   std::unique_ptr<ViewLinker> view_linker_;
   std::unique_ptr<ResourceLinker> resource_linker_;
+
+  // This is saved because it needs to live longer than the EventTimestamper
+  std::unique_ptr<sys::ComponentContext> app_context_;
 };
 
 TEST_F(CompositorTest, Validation) {