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

Unified Diff: chromeos/printing/fake_printer_discoverer.cc

Issue 2466993005: [CUPS] Fix the occasional crash when switching between different dialogs. (Closed)
Patch Set: Created 4 years, 1 month 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 | « chromeos/printing/fake_printer_discoverer.h ('k') | chromeos/printing/printer_discoverer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/printing/fake_printer_discoverer.cc
diff --git a/chromeos/printing/fake_printer_discoverer.cc b/chromeos/printing/fake_printer_discoverer.cc
index eb5804e06e629698251500b17103c46b8ef4f089..53828d5cfcd673630b61bf4fa9a12c615272b5ed 100644
--- a/chromeos/printing/fake_printer_discoverer.cc
+++ b/chromeos/printing/fake_printer_discoverer.cc
@@ -46,7 +46,9 @@ bool FakePrinterDiscoverer::StopDiscovery() {
}
void FakePrinterDiscoverer::AddObserver(PrinterDiscoverer::Observer* observer) {
- observers_.push_back(observer);
+ auto found = std::find(observers_.begin(), observers_.end(), observer);
+ if (found == observers_.end())
+ observers_.push_back(observer);
}
void FakePrinterDiscoverer::RemoveObserver(
« no previous file with comments | « chromeos/printing/fake_printer_discoverer.h ('k') | chromeos/printing/printer_discoverer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698