From: Abdelrazak Younes Date: Thu, 19 Oct 2006 14:35:06 +0000 (+0000) Subject: - Fix a crash when IN is clicked multiple time in a single line document. X-Git-Tag: 1.6.10~12348 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f23082917eea911c5f2374957d9500997fa016a3;p=features.git - Fix a crash when IN is clicked multiple time in a single line document. - Polish the behavior when the TOC is empty (clearing the button and the TOC tree) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15373 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/QToc.C b/src/frontends/qt4/QToc.C index a85e961741..8c43bc4a4b 100644 --- a/src/frontends/qt4/QToc.C +++ b/src/frontends/qt4/QToc.C @@ -58,6 +58,9 @@ QStandardItemModel * QToc::tocModel() << " toc_models_.size() " << toc_models_.size() << endl; + if (toc_models_.empty()) + return 0; + BOOST_ASSERT(type_ >= 0 && type_ < int(toc_models_.size())); return toc_models_[type_]; } @@ -118,8 +121,11 @@ void QToc::update() type_ = 0; vector const & types = getTypes(); - if (types.empty()) + if (types.empty()) { + type_model_.setStringList(type_list); + toc_models_.clear(); return; + } string const & selected_type = toc::getType(params().getCmdName()); lyxerr[Debug::GUI] << "selected_type " << selected_type << endl; diff --git a/src/frontends/qt4/QTocDialog.C b/src/frontends/qt4/QTocDialog.C index 34556d9673..9ebcd8b9de 100644 --- a/src/frontends/qt4/QTocDialog.C +++ b/src/frontends/qt4/QTocDialog.C @@ -190,6 +190,8 @@ void QTocDialog::updateGui() if (type_model->stringList().isEmpty()) { enableButtons(); + typeCO->setModel(type_model); + tocTV->setModel(new QStandardItemModel); return; }