On 03/12/2010 05:19 PM, Vincent van Ravesteijn - TNW wrote:
For some reason, it appears that there is no ErrorList in the main buffer.
I've touched this today.. I hope I didn't break anything. If you wanna
be sure try to revert the changes I made.
I think it is related, but I don't really understand what's happening
here. The attached seems to work, though.
Is there a typo in GuiErrorList::errorList(), where we have:
if (&bufferview()->buffer() == buf_)
Should it be "!="? I guess I don't understand what should happen in that
case.
Anyway, the crash seems to have been been here:
ErrorList::const_iterator it = errorList().begin();
ErrorList::const_iterator end = errorList().end();
for (; it != end; ++it)
errorsLW->addItem(toqstr(it->error));
and it was fixed by changing it to:
ErrorList const & el = errorList();
ErrorList::const_iterator it = el.begin();
ErrorList::const_iterator end = el.end();
for (; it != end; ++it)
errorsLW->addItem(toqstr(it->error));
So errorList() seems to have been returning different things the two
times. Very weird.
rh
Index: frontends/qt4/GuiView.cpp
===================================================================
--- frontends/qt4/GuiView.cpp (revision 33727)
+++ frontends/qt4/GuiView.cpp (working copy)
@@ -351,6 +351,8 @@
///
QFutureWatcher<docstring> autosave_watcher_;
QFutureWatcher<docstring> preview_watcher_;
+ ///
+ string last_export_format;
#else
struct DummyWatcher { bool isRunning(){return false;} };
DummyWatcher preview_watcher_;
@@ -447,6 +449,7 @@
QFutureWatcher<docstring> const * watcher =
static_cast<QFutureWatcher<docstring> const *>(sender());
message(watcher->result());
+ errors(d.last_export_format);
#endif
}
@@ -2824,6 +2827,7 @@
QFuture<docstring> f =
QtConcurrent::run(exportAndDestroy,
doc_buffer->clone(), format);
d.setPreviewFuture(f);
+ d.last_export_format = doc_buffer->bufferFormat();
#else
bool const update_unincluded =
doc_buffer->params().maintain_unincluded_children
@@ -2844,6 +2848,7 @@
QFuture<docstring> f =
QtConcurrent::run(previewAndDestroy,
doc_buffer->clone(), format);
d.setPreviewFuture(f);
+ d.last_export_format = doc_buffer->bufferFormat();
#else
bool const update_unincluded =
doc_buffer->params().maintain_unincluded_children
@@ -2863,6 +2868,7 @@
QFuture<docstring> f =
QtConcurrent::run(exportAndDestroy,
master->clone(), format);
d.setPreviewFuture(f);
+ d.last_export_format = doc_buffer->bufferFormat();
#else
bool const update_unincluded =
master->params().maintain_unincluded_children
@@ -2880,6 +2886,7 @@
QFuture<docstring> f =
QtConcurrent::run(previewAndDestroy,
master->clone(), format);
d.setPreviewFuture(f);
+ d.last_export_format = doc_buffer->bufferFormat();
#else
master->preview(format);
#endif
Index: frontends/qt4/GuiErrorList.cpp
===================================================================
--- frontends/qt4/GuiErrorList.cpp (revision 33727)
+++ frontends/qt4/GuiErrorList.cpp (working copy)
@@ -108,8 +108,9 @@
errorsLW->clear();
descriptionTB->setPlainText(QString());
- ErrorList::const_iterator it = errorList().begin();
- ErrorList::const_iterator end = errorList().end();
+ ErrorList const & el = errorList();
+ ErrorList::const_iterator it = el.begin();
+ ErrorList::const_iterator end = el.end();
for (; it != end; ++it)
errorsLW->addItem(toqstr(it->error));
errorsLW->setCurrentRow(0);
Index: Buffer.cpp
===================================================================
--- Buffer.cpp (revision 33727)
+++ Buffer.cpp (working copy)
@@ -3300,17 +3300,27 @@
bool const success = theConverters().convert(this, FileName(filename),
tmp_result_file, FileName(absFileName()), backend_format,
format,
error_list);
- // Emit the signal to show the error list.
+
+ // Emit the signal to show the error list or copy it back to the
+ // cloned Buffer so that it cab be emitted afterwards.
if (format != backend_format) {
- errors(error_type);
+ if (d->cloned_buffer_) {
+ LYXERR0(d->errorLists[error_type].size());
+ d->cloned_buffer_->d->errorLists[error_type] =
+ d->errorLists[error_type];
+ } else
+ errors(error_type);
// also to the children, in case of master-buffer-view
std::vector<Buffer *> clist = getChildren();
for (vector<Buffer *>::const_iterator cit = clist.begin();
- cit != clist.end(); ++cit)
- (*cit)->errors(error_type, true);
+ cit != clist.end(); ++cit) {
+ if (d->cloned_buffer_) {
+
(*cit)->d->cloned_buffer_->d->errorLists[error_type] =
+ (*cit)->d->errorLists[error_type];
+ } else
+ (*cit)->errors(error_type, true);
+ }
}
- if (!success)
- return false;
if (d->cloned_buffer_) {
// Enable reverse dvi or pdf to work by copying back the texrow
@@ -3318,8 +3328,13 @@
// FIXME: There is a possibility of concurrent access to texrow
// here from the main GUI thread that should be securized.
d->cloned_buffer_->d->texrow = d->texrow;
+ string const error_type = bufferFormat();
+ d->cloned_buffer_->d->errorLists[error_type] =
d->errorLists[error_type];
}
+ if (!success)
+ return false;
+
if (put_in_tempdir) {
result_file = tmp_result_file.absFilename();
return true;