From 887bae83908597b4d621c77cc3f59b082e5c8167 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 1 Nov 2006 13:14:21 +0000 Subject: [PATCH] Fix crash when reconfigure is called without Buffer nor BufferView. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15661 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyx_cb.C | 7 ++++--- src/lyx_cb.h | 3 ++- src/lyxfunc.C | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 4ca5a5a0ff..d61ebf3d1b 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -34,6 +34,7 @@ #include "frontends/Alert.h" #include "frontends/Application.h" #include "frontends/FileDialog.h" +#include "frontends/LyXView.h" #include "support/filefilterlist.h" #include "support/filetools.h" @@ -404,10 +405,10 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap // This function runs "configure" and then rereads lyx.defaults to // reconfigure the automatic settings. -void reconfigure(BufferView * bv) +void reconfigure(LyXView & lv) { // emit message signal. - bv->buffer()->message(_("Running configure...")); + lv.message(_("Running configure...")); // Run configure in user lyx directory support::Path p(package().user_support()); @@ -416,7 +417,7 @@ void reconfigure(BufferView * bv) one.startscript(Systemcall::Wait, configure_command); p.pop(); // emit message signal. - bv->buffer()->message(_("Reloading configuration...")); + lv.message(_("Reloading configuration...")); lyxrc.read(libFileSearch(string(), "lyxrc.defaults")); // Re-read packages.lst LaTeXFeatures::getAvailable(); diff --git a/src/lyx_cb.h b/src/lyx_cb.h index 246799d26c..da520d82b1 100644 --- a/src/lyx_cb.h +++ b/src/lyx_cb.h @@ -18,6 +18,7 @@ namespace lyx { class Buffer; class BufferView; +class LyXView; /// extern bool quitting; @@ -35,7 +36,7 @@ void insertAsciiFile(BufferView * bv, std::string const & f, bool asParagraph); /// std::string getContentsOfAsciiFile(BufferView * bv, std::string const & f, bool asParagraph); /// -void reconfigure(BufferView * bv); +void reconfigure(LyXView & lv); } // namespace lyx diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3c1a0f8a6a..c56556c2fd 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1055,7 +1055,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd) break; case LFUN_RECONFIGURE: - reconfigure(view()); + BOOST_ASSERT(lyx_view_); + reconfigure(*lyx_view_); break; case LFUN_HELP_OPEN: { -- 2.39.2