]> git.lyx.org Git - features.git/commitdiff
Work around dangling pointer
authorGuillaume Munch <gm@lyx.org>
Wed, 28 Sep 2016 19:57:54 +0000 (21:57 +0200)
committerGuillaume Munch <gm@lyx.org>
Sat, 3 Dec 2016 11:58:12 +0000 (12:58 +0100)
This pointer has been removed in master, but backporting the workaround is
enough.

(cherry picked from commit 79a947c9041a92805e9ac4b65594753410016fa5)

src/frontends/qt4/GuiViewSource.cpp
src/frontends/qt4/GuiViewSource.h

index 5a6a9664ff5e070425d6c575639cea2aafd3535b..660da59cdb6b3899b60fe0fb817405c622e6a837 100644 (file)
@@ -309,11 +309,11 @@ void ViewSourceWidget::realUpdateView()
 }
 
 
-docstring ViewSourceWidget::currentFormatName() const
+docstring ViewSourceWidget::currentFormatName(BufferView const * bv) const
 {
        // Compute the actual format used
-       string const format = !bv_ ? ""
-               : flavor2format(bv_->buffer().params().getOutputFlavor(view_format_));
+       string const format = !bv ? ""
+               : flavor2format(bv->buffer().params().getOutputFlavor(view_format_));
        Format const * f = formats.getFormat(format.empty() ? view_format_ : format);
        return from_utf8(f ? f->prettyname() : view_format_);
 }
@@ -453,7 +453,7 @@ bool GuiViewSource::initialiseParams(string const & /*source*/)
 
 void GuiViewSource::updateTitle()
 {
-       docstring const format = widget_->currentFormatName();
+       docstring const format = widget_->currentFormatName(bufferview());
        QString const title = format.empty() ? qt_("Code Preview")
                : qt_("%1[[preview format name]] Preview")
                  .arg(toqstr(translateIfPossible(format)));
index b90c514ce37bfd141809d4de1c6d98a41d63b51e..b7a5190ce275bc0ece6f0b6d9f056980e6af85c2 100644 (file)
@@ -65,7 +65,7 @@ public Q_SLOTS:
        ///
        void gotoCursor();
        /// Name of the current format. Empty if none.
-       docstring currentFormatName() const;
+       docstring currentFormatName(BufferView const * bv) const;
 
 Q_SIGNALS:
        void formatChanged() const;