fix crash due to invalidated iterator

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13241 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-02-15 11:13:37 +00:00
parent 5d14da2001
commit 36945644e7
4 changed files with 16 additions and 8 deletions

View 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> 2006-01-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ui/LanguageModuleBase.ui: fix layout. * ui/LanguageModuleBase.ui: fix layout.

View File

@ -29,6 +29,7 @@
using std::vector; using std::vector;
using std::string; using std::string;
using std::swap;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
@ -193,11 +194,10 @@ void QCitationDialog::up()
string const tmp = *it; string const tmp = *it;
selectedLB->removeItem(sel); selectedLB->removeItem(sel);
form_->citekeys.erase(it); swap(form_->citekeys[sel - 1], form_->citekeys[sel]);
selectedLB->insertItem(toqstr(tmp), sel - 1); selectedLB->insertItem(toqstr(tmp), sel - 1);
selectedLB->setSelected(sel - 1, true); selectedLB->setSelected(sel - 1, true);
form_->citekeys.insert(it - 1, tmp);
form_->changed(); form_->changed();
form_->fillStyles(); form_->fillStyles();
@ -214,11 +214,10 @@ void QCitationDialog::down()
string const tmp = *it; string const tmp = *it;
selectedLB->removeItem(sel); selectedLB->removeItem(sel);
form_->citekeys.erase(it); swap(form_->citekeys[sel + 1], form_->citekeys[sel]);
selectedLB->insertItem(toqstr(tmp), sel + 1); selectedLB->insertItem(toqstr(tmp), sel + 1);
selectedLB->setSelected(sel + 1, true); selectedLB->setSelected(sel + 1, true);
form_->citekeys.insert(it + 1, tmp);
form_->changed(); form_->changed();
form_->fillStyles(); form_->fillStyles();

View 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> 2005-12-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormPreferences.C: fix off-by-x errors in paper size setting * FormPreferences.C: fix off-by-x errors in paper size setting

View File

@ -30,6 +30,7 @@ using std::max;
using std::vector; using std::vector;
using std::string; using std::string;
using std::swap;
namespace lyx { namespace lyx {
@ -384,11 +385,10 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
string const tmp = *it; string const tmp = *it;
fl_delete_browser_line(dialog_->browser_cite, sel); 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_insert_browser_line(dialog_->browser_cite, sel - 1, tmp.c_str());
fl_select_browser_line(dialog_->browser_cite, sel - 1); fl_select_browser_line(dialog_->browser_cite, sel - 1);
citekeys.insert(it - 1, tmp);
setCiteButtons(ON); setCiteButtons(ON);
activate = ButtonPolicy::SMI_VALID; activate = ButtonPolicy::SMI_VALID;
@ -402,11 +402,10 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
string const tmp = *it; string const tmp = *it;
fl_delete_browser_line(dialog_->browser_cite, sel); 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_insert_browser_line(dialog_->browser_cite, sel+1, tmp.c_str());
fl_select_browser_line(dialog_->browser_cite, sel+1); fl_select_browser_line(dialog_->browser_cite, sel+1);
citekeys.insert(it+1, tmp);
setCiteButtons(ON); setCiteButtons(ON);
activate = ButtonPolicy::SMI_VALID; activate = ButtonPolicy::SMI_VALID;