Index: sky/viewer/content_handler_impl.cc |
diff --git a/sky/viewer/content_handler_impl.cc b/sky/viewer/content_handler_impl.cc |
index 63ce25c23a0944d11e2b1b6d86d0dc527dfffdcf..5bfeb732e1bb002e7a53ffb7e89164398a759c30 100644 |
--- a/sky/viewer/content_handler_impl.cc |
+++ b/sky/viewer/content_handler_impl.cc |
@@ -56,9 +56,19 @@ class SkyApplication : public mojo::Application { |
private: |
void OnViewDestroyed() { |
--view_count_; |
- if (view_count_ == 0) { |
- delete this; |
- } |
+ |
+ // TODO(eseidel): We can't destroy ourselves synchronously here |
Aaron Boodman
2014/12/05 23:29:50
This seems like a reasonable fix for now. I don't
|
+ // as we may be in the middle of a reload and doing so will cause |
+ // ConnectionManager::EmbedAtView / ViewManagerServiceImpl::Init |
+ // To end up sending the "AcceptConnection" to a dead SkyApplication |
+ // (which will be silently ignored). This manifests as every other |
+ // "reload" command in skydb tearing down SkyApplication and silently |
+ // failing. Another alternative would be to post a task to check if we |
+ // should delete ourselves. We should likely keep ourselves alive |
+ // so long as there is an active connection instead |
+ // if (view_count_ == 0) { |
+ // delete this; |
+ // } |
} |
void OnResponseReceived(mojo::URLLoaderPtr loader, |