From 4541e746fee89292ac3d69dadc0483cbaa742e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 27 Feb 2001 11:03:25 +0000 Subject: [PATCH] fix combo segfault git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1631 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 5 +++++ src/frontends/xforms/FormCharacter.C | 29 +++++++++++++--------------- src/frontends/xforms/FormCharacter.h | 5 +++-- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index e7b4dc2274..c65c2379a9 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2001-02-27 Lars Gullik Bjønnes + + * FormCharacter.C (FormCharacter): change order of deletion, + change combo_language2 to combo_language2_ + 2001-02-26 Dekel Tsur * FormRef.C (apply): Update bookmark #0 after inserting a reference. diff --git a/src/frontends/xforms/FormCharacter.C b/src/frontends/xforms/FormCharacter.C index be81b82b28..11ac59c9d1 100644 --- a/src/frontends/xforms/FormCharacter.C +++ b/src/frontends/xforms/FormCharacter.C @@ -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()); } - - diff --git a/src/frontends/xforms/FormCharacter.h b/src/frontends/xforms/FormCharacter.h index 5fc537783c..2f5317f8ac 100644 --- a/src/frontends/xforms/FormCharacter.h +++ b/src/frontends/xforms/FormCharacter.h @@ -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