]> git.lyx.org Git - features.git/commitdiff
fix crash due to invalidated iterator
authorJürgen Spitzmüller <spitz@lyx.org>
Wed, 15 Feb 2006 11:13:37 +0000 (11:13 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Wed, 15 Feb 2006 11:13:37 +0000 (11:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13241 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QCitationDialog.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormCitation.C

index 2ac7c575892fe972b689773577da0a78b22f8c7c..e1a307266613be76189b2f2bfdb45d5651463308 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-15  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QCitationDialog.C (up, down): fix crash due to invalidated
+       iterator.
+
 2006-01-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * ui/LanguageModuleBase.ui: fix layout.
index f34ff10e14c240ae5a4025123378a5efaec7033f..0e9f320570d14bfbb40ac925aad8bd5dda6800e1 100644 (file)
@@ -29,6 +29,7 @@
 
 using std::vector;
 using std::string;
+using std::swap;
 
 namespace lyx {
 namespace frontend {
@@ -193,11 +194,10 @@ void QCitationDialog::up()
        string const tmp = *it;
 
        selectedLB->removeItem(sel);
-       form_->citekeys.erase(it);
+       swap(form_->citekeys[sel - 1], form_->citekeys[sel]);
 
        selectedLB->insertItem(toqstr(tmp), sel - 1);
        selectedLB->setSelected(sel - 1, true);
-       form_->citekeys.insert(it - 1, tmp);
 
        form_->changed();
        form_->fillStyles();
@@ -214,11 +214,10 @@ void QCitationDialog::down()
        string const tmp = *it;
 
        selectedLB->removeItem(sel);
-       form_->citekeys.erase(it);
+       swap(form_->citekeys[sel + 1], form_->citekeys[sel]);
 
        selectedLB->insertItem(toqstr(tmp), sel + 1);
        selectedLB->setSelected(sel + 1, true);
-       form_->citekeys.insert(it + 1, tmp);
 
        form_->changed();
        form_->fillStyles();
index 4ddd7a89abe10bf3a975951148c34f874b07444b..06b8da0f36be4570412e2c7aab5c78a7f47cd529 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-15  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FormCitation.C (input): fix crash due to invalidated
+       iterator.
+
 2005-12-12  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * FormPreferences.C: fix off-by-x errors in paper size setting
index 6e2c7d5dca60d90a4002bcde427b155317ce09dc..5664f836e84774ed0195dd94cf78d345c8d5e378 100644 (file)
@@ -30,6 +30,7 @@ using std::max;
 
 using std::vector;
 using std::string;
+using std::swap;
 
 
 namespace lyx {
@@ -384,11 +385,10 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
                string const tmp = *it;
 
                fl_delete_browser_line(dialog_->browser_cite, sel);
-               citekeys.erase(it);
+               swap(citekeys[sel - 2], citekeys[sel - 1]);
 
                fl_insert_browser_line(dialog_->browser_cite, sel - 1, tmp.c_str());
                fl_select_browser_line(dialog_->browser_cite, sel - 1);
-               citekeys.insert(it - 1, tmp);
                setCiteButtons(ON);
                activate = ButtonPolicy::SMI_VALID;
 
@@ -402,11 +402,10 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
                string const tmp = *it;
 
                fl_delete_browser_line(dialog_->browser_cite, sel);
-               citekeys.erase(it);
+               swap(citekeys[sel], citekeys[sel - 1]);
 
                fl_insert_browser_line(dialog_->browser_cite, sel+1, tmp.c_str());
                fl_select_browser_line(dialog_->browser_cite, sel+1);
-               citekeys.insert(it+1, tmp);
                setCiteButtons(ON);
                activate = ButtonPolicy::SMI_VALID;