mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
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:
parent
77f2d2e7d2
commit
d4cacf3642
@ -34,11 +34,14 @@
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/debug.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/ExceptionMessage.h"
|
||||
#include "support/gettext.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
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()
|
||||
{
|
||||
if (buffer_)
|
||||
return *buffer_;
|
||||
LYXERR0("DUMMYBUFFER FOR " << lyxCode());
|
||||
return theDummyBuffer();
|
||||
if (!buffer_) {
|
||||
odocstringstream s;
|
||||
s << "LyX Code: " << lyxCode();
|
||||
throw ExceptionMessage(WarningException,
|
||||
from_ascii("Inset::buffer_ member not initialized!"), s.str());
|
||||
}
|
||||
return *buffer_;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user