]> git.lyx.org Git - features.git/commitdiff
Fix thinko in Buffer::preview. It is possible for this routine to
authorRichard Heck <rgheck@lyx.org>
Sun, 10 Jul 2016 05:12:42 +0000 (01:12 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 10 Jul 2016 05:17:54 +0000 (01:17 -0400)
be called when we do not have a cloned Buffer, namely, if we do not
have EXPORT_in_THREAD defined.

(cherry picked from commit d8aab4af9e6e72c835f78ba54a46687b870c25fa)

src/Buffer.cpp
status.22x

index d9dc38f800734ce1331746cb8186133b338967e0..22c993ca8b93401096459768007352e1e4599851 100644 (file)
@@ -4311,10 +4311,10 @@ Buffer::ExportStatus Buffer::preview(string const & format, bool includeall) con
        ExportStatus const status = doExport(format, true, false, result_file);
        FileName const previewFile(result_file);
 
-       LATTEST (isClone());
-       d->cloned_buffer_->d->preview_file_ = previewFile;
-       d->cloned_buffer_->d->preview_format_ = format;
-       d->cloned_buffer_->d->preview_error_ = (status != ExportSuccess);
+       Impl * theimpl = isClone() ? d->cloned_buffer_->d : d;
+       theimpl->preview_file_ = previewFile;
+       theimpl->preview_format_ = format;
+       theimpl->preview_error_ = (status != ExportSuccess);
 
        if (status != ExportSuccess)
                return status;
@@ -4323,14 +4323,11 @@ Buffer::ExportStatus Buffer::preview(string const & format, bool includeall) con
                        return PreviewError;
                else
                        return PreviewSuccess;
-       }
-       else {
-               // Successful export but no output file?
-               // Probably a bug in error detection.
-               LATTEST (status != ExportSuccess);
-
-               return status;
-       }
+       } 
+       // Successful export but no output file?
+       // Probably a bug in error detection.
+       LATTEST(status != ExportSuccess);
+       return status;
 }
 
 
index 1c25a8b62a7818ac1d20f8ad3cf4a519422553b1..48592995254f10777a3fb6d4342e792b56e364c9 100644 (file)
@@ -89,6 +89,8 @@ What's new
 
 - Fix command clash between beamer and covington (from the Linguistics module).
 
+- Fix crash on Buffer preview when not exporting in thread.
+
 
 * LYX2LYX