+
// Copyright (C) 2011,2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// the dictionary and/or duplicates.
int i = 0;
while (values_[i]) {
- global_logger_duplicates_->remove(values_[i]);
- global_dictionary_->erase(values_[i], values_[i + 1]);
+ // Check if the unloaded message is registered as duplicate. If it is,
+ // remove it from the duplicates list.
+ LoggerDuplicatesList::const_iterator dup =
+ std::find(global_logger_duplicates_->begin(),
+ global_logger_duplicates_->end(),
+ values_[i]);
+ if (dup != global_logger_duplicates_->end()) {
+ global_logger_duplicates_->erase(dup);
+
+ } else {
+ global_dictionary_->erase(values_[i], values_[i + 1]);
+ }
i += 2;
}
}
};
const char* values4[] = {
- "GLOBAL8", "global message eight bis",
+ "GLOBAL8", "global message eight",
"GLOBAL9", "global message nine",
NULL
};
EXPECT_EQ("global message eight", global->getText("GLOBAL8"));
EXPECT_EQ("global message nine", global->getText("GLOBAL9"));
- // Destroy the first initializer. The first two messages should
- // be unregistered.
+ // Destroy the first initializer. The first message should be removed.
+ // The second message should not be removed because it is also held
+ // by another object.
init1.reset();
EXPECT_TRUE(global->getText("GLOBAL7").empty());
- EXPECT_TRUE(global->getText("GLOBAL8").empty());
+ EXPECT_EQ("global message eight", global->getText("GLOBAL8"));
EXPECT_EQ("global message nine", global->getText("GLOBAL9"));
// Destroy the second initializer. Now, all messages should be