From c6e4985a07e907a73d100f2055df45adbb7d74b8 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 4 Dec 2006 13:52:02 +0000 Subject: [PATCH] * GuiApplication::x11EventFilter(): check for currentView() before using it. * Application::currentView(): now returns a pointer. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16170 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/Application.C | 8 ++++---- src/frontends/Application.h | 4 ++-- src/frontends/WorkArea.C | 2 +- src/frontends/qt4/GuiApplication.C | 5 ++++- src/frontends/qt4/GuiWorkArea.C | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/frontends/Application.C b/src/frontends/Application.C index 0f3fa8c2d8..986d56128d 100644 --- a/src/frontends/Application.C +++ b/src/frontends/Application.C @@ -71,15 +71,15 @@ LyXView & Application::createView(unsigned int width, } -LyXView const & Application::currentView() const +LyXView const * Application::currentView() const { - return *current_view_; + return current_view_; } -LyXView & Application::currentView() +LyXView * Application::currentView() { - return *current_view_; + return current_view_; } diff --git a/src/frontends/Application.h b/src/frontends/Application.h index 748f1cf7b7..e782213264 100644 --- a/src/frontends/Application.h +++ b/src/frontends/Application.h @@ -176,10 +176,10 @@ public: const std::string & geometryArg); /// - LyXView const & currentView() const; + LyXView const * currentView() const; /// - LyXView & currentView(); + LyXView * currentView(); /// void setCurrentView(LyXView & current_view); diff --git a/src/frontends/WorkArea.C b/src/frontends/WorkArea.C index a4b870e7ea..cc9455c599 100644 --- a/src/frontends/WorkArea.C +++ b/src/frontends/WorkArea.C @@ -142,7 +142,7 @@ void WorkArea::redraw() // No need to do anything if this is the current view. The BufferView // metrics are already up to date. - if (&lyx_view_ != &theApp()->currentView()) + if (&lyx_view_ != theApp()->currentView()) // FIXME: it would be nice to optimize for the off-screen case. buffer_view_->updateMetrics(false); diff --git a/src/frontends/qt4/GuiApplication.C b/src/frontends/qt4/GuiApplication.C index 99b5a78794..b752ad3988 100644 --- a/src/frontends/qt4/GuiApplication.C +++ b/src/frontends/qt4/GuiApplication.C @@ -291,7 +291,10 @@ void GuiApplication::unregisterSocketCallback(int fd) #ifdef Q_WS_X11 bool GuiApplication::x11EventFilter(XEvent * xev) { - BufferView * bv = currentView().view(); + if (!currentView()) + return false; + + BufferView * bv = currentView()->view(); switch (xev->type) { case SelectionRequest: diff --git a/src/frontends/qt4/GuiWorkArea.C b/src/frontends/qt4/GuiWorkArea.C index eb743e0a34..d2ff528ebd 100644 --- a/src/frontends/qt4/GuiWorkArea.C +++ b/src/frontends/qt4/GuiWorkArea.C @@ -255,7 +255,7 @@ void GuiWorkArea::dropEvent(QDropEvent* event) void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/) { // No need to do anything if we didn't change views... - if (theApp() == 0 || &lyx_view_ == &theApp()->currentView()) + if (theApp() == 0 || &lyx_view_ == theApp()->currentView()) return; theApp()->setCurrentView(lyx_view_); @@ -287,7 +287,7 @@ void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/) void GuiWorkArea::focusOutEvent(QFocusEvent * /*event*/) { // No need to do anything if we didn't change views... - if (&lyx_view_ == &theApp()->currentView()) + if (&lyx_view_ == theApp()->currentView()) return; stopBlinkingCursor(); -- 2.39.2