diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-09-17 12:25:34 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-09-17 12:25:34 -0400 |
commit | 9c0ee34dca7e8eba63d94788148bb4c324b8875f (patch) | |
tree | f43ad32356ab956c0668c2f6ce3024c47a1f6a9d | |
parent | Fix to previous fix. (diff) | |
download | ice-9c0ee34dca7e8eba63d94788148bb4c324b8875f.tar.bz2 ice-9c0ee34dca7e8eba63d94788148bb4c324b8875f.tar.xz ice-9c0ee34dca7e8eba63d94788148bb4c324b8875f.zip |
Fixed bug #2461
-rw-r--r-- | cpp/src/Freeze/MapI.cpp | 1 | ||||
-rw-r--r-- | cpp/test/Freeze/dbmap/Client.cpp | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index ee2b1de0e3a..57728bc8f0e 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -1313,6 +1313,7 @@ Freeze::MapHelperI::close() { if(_db != 0) { + closeAllIterators(); _connection->unregisterMap(this); } _db = 0; diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index 17af3c7120b..4d602cb39f4 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -851,6 +851,54 @@ main(int argc, char* argv[]) status = EXIT_FAILURE; } + + cout << "testing manual code... " << flush; + + // + // From manual + // + + Freeze::ConnectionPtr connection = + Freeze::createConnection(communicator, envName); + + // Instantiate the map. + // + ByteIntMap map(connection, "simple"); + + // Clear the map. + // + map.clear(); + + Ice::Int i; + ByteIntMap::iterator p; + + // Populate the map. + // + for (i = 0; i < 26; i++) + { + Ice::Byte key = static_cast<Ice::Byte>('a' + i); + map.insert(make_pair(key, i)); + } + + // Iterate over the map and change the values. + // + for (p = map.begin(); p != map.end(); ++p) + { + p.set(p->second + 1); + } + + // Find and erase the last element. + // + p = map.find(static_cast<Ice::Byte>('z')); + assert(p != map.end()); + map.erase(p); + + // Clean up. + // + connection->close(); + + cout << "ok" << endl; + try { communicator->destroy(); |