]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiToc.cpp
Fix dangling inset pointers after buffer reload
[lyx.git] / src / frontends / qt4 / GuiToc.cpp
index a18fbba03aa3ad5da992bc5ac01b640d2d782613..29ec85c27ff9db904df6e0a4104ae91c75702584 100644 (file)
@@ -50,7 +50,6 @@ GuiToc::~GuiToc()
 void GuiToc::updateView()
 {
        widget_->updateView();
-       return;
 }
 
 
@@ -66,16 +65,18 @@ void GuiToc::dispatchParams()
 }
 
 
-void GuiToc::enableView(bool /*enable*/)
+void GuiToc::enableView(bool enable)
 {
-       widget_->updateViewForce();
+       if (!enable)
+               // In the opposite case, updateView() will be called anyway.
+               widget_->updateViewNow();
 }
 
 
 void GuiToc::closeEvent(QCloseEvent * /*event*/)
 {
        is_closing_ = true;
-       ((GuiView *)parent())->updateToolbars();
+       static_cast<GuiView *>(parent())->updateToolbars();
        is_closing_ = false;
 }
 
@@ -95,15 +96,7 @@ bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
 
 Dialog * createGuiToc(GuiView & lv)
 {
-       GuiToc * toc;
-#ifdef Q_OS_MAC
-       // On Mac show at the right and floating
-       toc = new GuiToc(lv, Qt::RightDockWidgetArea);
-       toc->setFloating(true);
-#else
-       toc = new GuiToc(lv);
-#endif
-       return toc;
+       return new GuiToc(lv);
 }