Skip to content

Commit

Permalink
MidiManagerAndroid: containers' clear and empty check were not matched
Browse files Browse the repository at this point in the history
In Finalize(), MidiManagerAndroid clears |input_port_to_index_| and
|output_port_to_index_| explicitly, but checks |all_input_ports| and
|all_output_ports| to be empty in the destructor.

We should clear and check all four members in Finalize() and destructor.

Bug: 788684
Change-Id: Ia60f57a6faedb89559b0bb1019605bbcc0b78522
Reviewed-on: https://chromium-review.googlesource.com/790076
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519590}
  • Loading branch information
toyoshim authored and Commit Bot committed Nov 28, 2017
1 parent 06c2716 commit d9de72a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions media/midi/midi_manager_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ MidiManagerAndroid::~MidiManagerAndroid() {
base::AutoLock lock(lock_);
DCHECK(devices_.empty());
DCHECK(all_input_ports_.empty());
DCHECK(input_port_to_index_.empty());
DCHECK(all_output_ports_.empty());
DCHECK(output_port_to_index_.empty());
DCHECK(raw_manager_.is_null());
}

Expand All @@ -79,7 +81,9 @@ void MidiManagerAndroid::Finalize() {
// is enabled by default.
base::AutoLock lock(lock_);
devices_.clear();
all_input_ports_.clear();
input_port_to_index_.clear();
all_output_ports_.clear();
output_port_to_index_.clear();
raw_manager_.Reset();
}
Expand Down

0 comments on commit d9de72a

Please sign in to comment.