Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: remoting/host/native_messaging/log_message_handler.cc

Issue 2867623002: Fixing a crash in our native messaging host binaries (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/native_messaging/log_message_handler.cc
diff --git a/remoting/host/native_messaging/log_message_handler.cc b/remoting/host/native_messaging/log_message_handler.cc
index 70f744b87e87b1d5ddcd84c486a7b06c720dc715..02c4f757e807a5d406120d4db38b6f665fffe8ed 100644
--- a/remoting/host/native_messaging/log_message_handler.cc
+++ b/remoting/host/native_messaging/log_message_handler.cc
@@ -125,9 +125,13 @@ void LogMessageHandler::SendLogMessageToClient(
dictionary->SetString("file", file);
dictionary->SetInteger("line", line);
+ // Protect against this instance being torn down after the delegate is run.
+ base::WeakPtr<LogMessageHandler> self = weak_ptr_factory_.GetWeakPtr();
delegate_.Run(std::move(dictionary));
- suppress_logging_ = false;
+ if (self) {
+ suppress_logging_ = false;
+ }
}
} // namespace remoting
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698