On 03/12/2010 04:58 PM, rgheck wrote:
On 03/12/2010 04:09 PM, Abdelrazak Younes wrote:
On 12/03/2010 19:15, Pavel Sanda wrote:
Comments welcome, of course, but the main question is for Pavel: Can this
go now, or do you want me to wait?
i would wait. Abdel its possible to look at the error dialog which do not
appear anymore due to the buffer cloning?

Does this patch helps? (untested, sorry, no time here).

No. The problem is that last_format is dvi, not latex. More generally, errors could come anywhere along the conversion path.

So I fixed that problem, which wasn't as I described. That gives us the attached patch. But then I get the crash below. I was also seeing this with an attempt of my own. For some reason, it appears that there is no ErrorList in the main buffer.

rh

====

/usr/lib/gcc/x86_64-redhat-linux/4.4.3/../../../../include/c++/4.4.3/debug/safe_iterator.h:460:

error: attempt to compare a singular iterator to a past-the-end iterator

.

Objects involved in the operation:

iterator "lhs" @ 0x0x7fffffff9520 {

type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKN3lyx9ErrorItemENSt6__norm6vectorIS4_SaIS4_EEEEENSt7__debug6vectorIS4_S9_EEEE (constant iterator);

state = singular;

references sequence with type `NSt7__debug6vectorIN3lyx9ErrorItemESaIS2_EEE' @ 0x0x7fffffff9520

}

iterator "rhs" @ 0x0x7fffffff94f0 {

type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPKN3lyx9ErrorItemENSt6__norm6vectorIS4_SaIS4_EEEEENSt7__debug6vectorIS4_S9_EEEE (constant iterator);

state = past-the-end;

references sequence with type `NSt7__debug6vectorIN3lyx9ErrorItemESaIS2_EEE' @ 0x0x7fffffff94f0

}


0    raise    raise.c    64    0x0000003881e326c5
1    abort    abort.c    92    0x0000003881e33ea5
2 __gnu_debug::_Error_formatter::_M_error debug.cc 527 0x0000003886e60c94 3 operator!=<__gnu_cxx::__normal_iterator<lyx::ErrorItem const*, std::__norm::vector<lyx::ErrorItem, std::allocator<lyx::ErrorItem> > >, std::__debug::vector<lyx::ErrorItem, std::allocator<lyx::ErrorItem> > > safe_iterator.h 457 0x0000000000a6f917 4 lyx::frontend::GuiErrorList::paramsToDialog GuiErrorList.cpp 113 0x0000000000a6f917 5 lyx::frontend::GuiErrorList::initialiseParams GuiErrorList.cpp 143 0x0000000000a70074 6 lyx::frontend::Dialog::showData Dialog.cpp 129 0x00000000009d59e8 7 lyx::frontend::GuiView::doShowDialog GuiView.cpp 3410 0x0000000000964df1 8 lyx::frontend::GuiView::qt_metacall moc_GuiView.cpp 112 0x0000000000974283
9    QMetaObject::activate    qobject.cpp    3293    0x0000003a4c56a2af
10 lyx::frontend::GuiView::triggerShowDialog moc_GuiView.cpp 133 0x0000000000960cf8 11 lyx::frontend::GuiView::showDialog GuiView.cpp 3393 0x0000000000963643 12 lyx::frontend::GuiView::errors GuiView.cpp 1250 0x00000000009630bc 13 lyx::frontend::GuiView::threadFinished GuiView.cpp 452 0x0000000000961e94 14 lyx::frontend::GuiView::qt_metacall moc_GuiView.cpp 111 0x000000000097426a
15    QMetaObject::activate    qobject.cpp    3293    0x0000003a4c56a2af
16 QFutureWatcherBase::event qfuturewatcher.cpp 344 0x0000003a4c4646b7 17 QApplicationPrivate::notify_helper qapplication.cpp 4300 0x0000003a4cbaa9dc 18 QApplication::notify qapplication.cpp 4183 0x0000003a4cbb0aab 19 lyx::frontend::GuiApplication::notify GuiApplication.cpp 2124 0x000000000093d10b 20 QCoreApplication::notifyInternal qcoreapplication.cpp 704 0x0000003a4c55774c
... <More>

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: Buffer.cpp
===================================================================
--- Buffer.cpp  (revision 33727)
+++ Buffer.cpp  (working copy)
@@ -3300,17 +3300,26 @@
        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_) {
+                       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 +3327,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;

Reply via email to