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
This commit is contained in:
Abdelrazak Younes 2006-11-01 13:14:21 +00:00
parent efcafae120
commit 887bae8390
3 changed files with 8 additions and 5 deletions

View File

@ -34,6 +34,7 @@
#include "frontends/Alert.h" #include "frontends/Alert.h"
#include "frontends/Application.h" #include "frontends/Application.h"
#include "frontends/FileDialog.h" #include "frontends/FileDialog.h"
#include "frontends/LyXView.h"
#include "support/filefilterlist.h" #include "support/filefilterlist.h"
#include "support/filetools.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 // This function runs "configure" and then rereads lyx.defaults to
// reconfigure the automatic settings. // reconfigure the automatic settings.
void reconfigure(BufferView * bv) void reconfigure(LyXView & lv)
{ {
// emit message signal. // emit message signal.
bv->buffer()->message(_("Running configure...")); lv.message(_("Running configure..."));
// Run configure in user lyx directory // Run configure in user lyx directory
support::Path p(package().user_support()); support::Path p(package().user_support());
@ -416,7 +417,7 @@ void reconfigure(BufferView * bv)
one.startscript(Systemcall::Wait, configure_command); one.startscript(Systemcall::Wait, configure_command);
p.pop(); p.pop();
// emit message signal. // emit message signal.
bv->buffer()->message(_("Reloading configuration...")); lv.message(_("Reloading configuration..."));
lyxrc.read(libFileSearch(string(), "lyxrc.defaults")); lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
// Re-read packages.lst // Re-read packages.lst
LaTeXFeatures::getAvailable(); LaTeXFeatures::getAvailable();

View File

@ -18,6 +18,7 @@ namespace lyx {
class Buffer; class Buffer;
class BufferView; class BufferView;
class LyXView;
/// ///
extern bool quitting; 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); std::string getContentsOfAsciiFile(BufferView * bv, std::string const & f, bool asParagraph);
/// ///
void reconfigure(BufferView * bv); void reconfigure(LyXView & lv);
} // namespace lyx } // namespace lyx

View File

@ -1055,7 +1055,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_RECONFIGURE: case LFUN_RECONFIGURE:
reconfigure(view()); BOOST_ASSERT(lyx_view_);
reconfigure(*lyx_view_);
break; break;
case LFUN_HELP_OPEN: { case LFUN_HELP_OPEN: {