]> 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:12:42 +0000 (01:12 -0400)
be called when we do not have a cloned Buffer, namely, if we do not
have EXPORT_in_THREAD defined.

src/Buffer.cpp

index a64e4b68eafcdc969deebbf4382e0bc40eee9b43..bcefe52513f324fb372754ac6f2321811b7a5c4e 100644 (file)
@@ -4315,10 +4315,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;
@@ -4327,14 +4327,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;
 }