fix combo segfault

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1631 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-02-27 11:03:25 +00:00
parent 304919918e
commit 4541e746fe
3 changed files with 21 additions and 18 deletions

View File

@ -1,3 +1,8 @@
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* FormCharacter.C (FormCharacter): change order of deletion,
change combo_language2 to combo_language2_
2001-02-26 Dekel Tsur <dekelts@tau.ac.il>
* FormRef.C (apply): Update bookmark #0 after inserting a reference.

View File

@ -33,7 +33,7 @@ using Liason::setMinibuffer;
FormCharacter::FormCharacter(LyXView * lv, Dialogs * d)
: FormBaseBD(lv, d, _("Character Layout"),
new NoRepeatedApplyReadOnlyPolicy),
dialog_(0), combo_language2(0)
dialog_(0), combo_language2_(0)
{
// let the popup be shown
// This is a permanent connection so we won't bother
@ -46,9 +46,9 @@ FormCharacter::FormCharacter(LyXView * lv, Dialogs * d)
FormCharacter::~FormCharacter()
{
delete dialog_;
delete combo_language2;
// This must be done before the deletion of the dialog.
delete combo_language2_;
delete dialog_;
}
@ -59,6 +59,7 @@ FL_FORM * FormCharacter::form() const
return 0;
}
void FormCharacter::build()
{
dialog_ = build_character();
@ -93,20 +94,18 @@ void FormCharacter::build()
// insert default language box manually
fl_addto_form(dialog_->form);
FL_OBJECT * ob = dialog_->choice_language;
combo_language2 = new Combox(FL_COMBOX_DROPLIST);
combo_language2->add(ob->x, ob->y, ob->w, ob->h, 250);
combo_language2->shortcut("#L", 1);
combo_language2_ = new Combox(FL_COMBOX_DROPLIST);
combo_language2_->add(ob->x, ob->y, ob->w, ob->h, 250);
combo_language2_->shortcut("#L", 1);
fl_end_form();
// build up the combox entries
combo_language2->addline(_("No change"));
combo_language2->addline(_("Reset"));
combo_language2_->addline(_("No change"));
combo_language2_->addline(_("Reset"));
for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) {
combo_language2->addto((*cit).second.lang());
combo_language2_->addto((*cit).second.lang());
}
}
@ -195,13 +194,13 @@ void FormCharacter::apply()
case 11: font.setColor(LColor::inherit); break;
}
int const choice = combo_language2->get();
int const choice = combo_language2_->get();
if (choice == 1)
font.setLanguage(ignore_language);
else if (choice == 2)
font.setLanguage(lv_->buffer()->params.language);
else
font.setLanguage(languages.getLanguage(combo_language2->getline()));
font.setLanguage(languages.getLanguage(combo_language2_->getline()));
bool toggleall = fl_get_button(dialog_->check_toggle_all);
@ -219,5 +218,3 @@ void FormCharacter::update()
bc_.readOnly(lv_->buffer()->isReadonly());
}

View File

@ -1,3 +1,4 @@
// -*- C++ -*-
/**
* \file FormCharacter.h
* Copyright 2001 The LyX Team.
@ -50,9 +51,9 @@ private:
FD_form_character * build_character();
/// Real GUI implementation.
FD_form_character * dialog_;
FD_form_character * dialog_;
Combox * combo_language2;
Combox * combo_language2_;
};
#endif