diff options
author | Hiroshi Sumita <hsumita@chromium.org> | 2012-06-05 10:13:15 -0400 |
---|---|---|
committer | Peng Huang <shawn.p.huang@gmail.com> | 2012-06-05 10:13:15 -0400 |
commit | df6277ec1df790ee34d261424353195e81212319 (patch) | |
tree | 3f3d26723f317d89d41457fa90a97fecf5db67de | |
parent | 8383301267a8bff72e4dfcbe7d1a00096789065b (diff) | |
download | ibus-pinyin-df6277ec1df790ee34d261424353195e81212319.tar.gz |
Fixes a bug caused by a reallocation on vector.
BUG=Database::query crashes on some situation
TEST=Manual
Review URL: https://codereview.appspot.com/6294043
Patch from Hiroshi Sumita <hsumita@chromium.org>.
-rw-r--r-- | src/PYDatabase.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/PYDatabase.cc b/src/PYDatabase.cc index 634e4b6..5bcc3c1 100644 --- a/src/PYDatabase.cc +++ b/src/PYDatabase.cc @@ -46,6 +46,7 @@ public: void double_ (void) { gint i = size (); + reserve (i * 2); do { push_back (at (--i)); } while (i > 0); @@ -53,8 +54,9 @@ public: void triple (void) { gint i = size (); + reserve (i * 3); do { - const std::string & value = std::vector<std::string>::at (--i); + const std::string & value = at (--i); push_back (value); push_back (value); } while (i > 0); |