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

Unified Diff: base/message_pump_glib.cc

Issue 558048: Changes message_pump_glib not to crash if run without corresponding... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 11 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: base/message_pump_glib.cc
===================================================================
--- base/message_pump_glib.cc (revision 37536)
+++ base/message_pump_glib.cc (working copy)
@@ -220,7 +220,8 @@
int MessagePumpForUI::HandlePrepare() {
// We know we have work, but we haven't called HandleDispatch yet. Don't let
// the pump block so that we can do some processing.
- if (state_->has_work)
+ if (state_ && // state_ may be null during tests.
+ state_->has_work)
return 0;
// We don't think we have work to do, but make sure not to block
@@ -229,6 +230,9 @@
}
bool MessagePumpForUI::HandleCheck() {
+ if (!state_) // state_ may be null during tests.
+ return false;
+
// We should only ever have a single message on the wakeup pipe, since we
// are only signaled when the queue went from empty to non-empty. The glib
// poll will tell us whether there was data, so this read shouldn't block.
@@ -317,7 +321,8 @@
MessagePumpForUI* message_pump = reinterpret_cast<MessagePumpForUI*>(data);
message_pump->WillProcessEvent(event);
- if (message_pump->state_->dispatcher) {
+ if (message_pump->state_ && // state_ may be null during tests.
+ message_pump->state_->dispatcher) {
if (!message_pump->state_->dispatcher->Dispatch(event))
message_pump->state_->should_quit = true;
} else {
« 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