Fix crash on exit because of static dummy Buffer.

* Inset::buffer(): replace dummy buffer with exception throwing.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23306 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-28 07:58:00 +00:00
parent 77f2d2e7d2
commit d4cacf3642

View File

@ -34,11 +34,14 @@
#include "support/convert.h" #include "support/convert.h"
#include "support/debug.h" #include "support/debug.h"
#include "support/docstream.h"
#include "support/ExceptionMessage.h"
#include "support/gettext.h" #include "support/gettext.h"
#include <map> #include <map>
using namespace std; using namespace std;
using namespace lyx::support;
namespace lyx { namespace lyx {
@ -122,19 +125,15 @@ void Inset::setBuffer(Buffer & buffer)
} }
static Buffer & theDummyBuffer()
{
static Buffer dummyBuffer("nobuffer.lyx", true);
return dummyBuffer;
}
Buffer & Inset::buffer() Buffer & Inset::buffer()
{ {
if (buffer_) if (!buffer_) {
return *buffer_; odocstringstream s;
LYXERR0("DUMMYBUFFER FOR " << lyxCode()); s << "LyX Code: " << lyxCode();
return theDummyBuffer(); throw ExceptionMessage(WarningException,
from_ascii("Inset::buffer_ member not initialized!"), s.str());
}
return *buffer_;
} }