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

Side by Side Diff: dbus/object_manager.cc

Issue 1055713002: Fix memory leak in dbus::ObjectManager::RemoveInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "dbus/object_manager.h" 5 #include "dbus/object_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return; 475 return;
476 476
477 // Inform the interface before removing the properties structure or object 477 // Inform the interface before removing the properties structure or object
478 // in case it needs details from them to make its own decisions. 478 // in case it needs details from them to make its own decisions.
479 InterfaceMap::iterator iiter = interface_map_.find(interface_name); 479 InterfaceMap::iterator iiter = interface_map_.find(interface_name);
480 if (iiter != interface_map_.end()) { 480 if (iiter != interface_map_.end()) {
481 Interface* interface = iiter->second; 481 Interface* interface = iiter->second;
482 interface->ObjectRemoved(object_path, interface_name); 482 interface->ObjectRemoved(object_path, interface_name);
483 } 483 }
484 484
485 delete piter->second;
485 object->properties_map.erase(piter); 486 object->properties_map.erase(piter);
486 487
487 if (object->properties_map.empty()) { 488 if (object->properties_map.empty()) {
488 object_map_.erase(oiter); 489 object_map_.erase(oiter);
489 delete object; 490 delete object;
490 } 491 }
491 } 492 }
492 493
493 void ObjectManager::NameOwnerChanged(const std::string& old_owner, 494 void ObjectManager::NameOwnerChanged(const std::string& old_owner,
494 const std::string& new_owner) { 495 const std::string& new_owner) {
(...skipping 22 matching lines...) Expand all
517 RemoveInterface(object_path, *iiter); 518 RemoveInterface(object_path, *iiter);
518 } 519 }
519 520
520 } 521 }
521 522
522 if (!new_owner.empty()) 523 if (!new_owner.empty())
523 GetManagedObjects(); 524 GetManagedObjects();
524 } 525 }
525 526
526 } // namespace dbus 527 } // namespace dbus
OLDNEW
« 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