branch: Fix part 2 of bug #5758: Crash when closing the dosbox from which LyX was started.

A problem occurs when we write the ConverterCache index file. This action is instantiated in the destructor of the 'static ConverterCache' object. The use of QFileInfo at that point leads to a crash.

It is maybe not a good idea at all to put part of the functionality in a destructor, especially not when we do not delete the object ourselves and when this functionality uses external libraries etc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@29608 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-05-10 11:07:03 +00:00
parent a6b4e213b6
commit a2316bd480
4 changed files with 15 additions and 1 deletions

View File

@ -218,7 +218,6 @@ ConverterCache::~ConverterCache()
{
if (!lyxrc.use_converter_cache)
return;
pimpl_->writeIndex();
delete pimpl_;
}
@ -248,6 +247,12 @@ void ConverterCache::init()
}
void ConverterCache::writeIndex() const
{
pimpl_->writeIndex();
}
void ConverterCache::add(FileName const & orig_from, string const & to_format,
FileName const & converted_file) const
{

View File

@ -55,6 +55,9 @@ public:
/// Init the cache. This must be done after package initialization.
static void init();
/// Writes the index list. This must be called on exit.
void writeIndex() const;
/**
* Add \c converted_file (\c orig_from converted to \c to_format) to
* the cache if it is not already in or not up to date.

View File

@ -354,6 +354,9 @@ void LyX::prepareExit()
cap::clearCutStack();
cap::clearSelection();
// Write the index file of the converter cache
ConverterCache::get().writeIndex();
// close buffers first
pimpl_->buffer_list_.closeAll();

View File

@ -190,6 +190,9 @@ What's new
- Fix crash when closing a child after it has been unincluded from its
master (bug 5859).
- Fix crash when the dos-box is closed from which LyX was started
(bug 5758).
- Fix crash when passing a nonexisting file to the lyx function
server-goto-file-row.