]> git.lyx.org Git - features.git/commitdiff
* GuiApplication::x11EventFilter(): check for currentView() before using it.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 4 Dec 2006 13:52:02 +0000 (13:52 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 4 Dec 2006 13:52:02 +0000 (13:52 +0000)
* 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
src/frontends/Application.h
src/frontends/WorkArea.C
src/frontends/qt4/GuiApplication.C
src/frontends/qt4/GuiWorkArea.C

index 0f3fa8c2d8cac19db706d860f790c20c586e0e7f..986d56128d58d518d0e3f24a532e2fa9d0ec0ac1 100644 (file)
@@ -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_;
 }
 
 
index 748f1cf7b7a3adb2a3193ad652b7c3ff12e678a2..e78221326400ac626db6a2f45b63ea81d5dea2ca 100644 (file)
@@ -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);
index a4b870e7ea1f92bcefe1ed37b6db2bda12ff3eeb..cc9455c5999e8e944fd87df717f2c0107e7d9af4 100644 (file)
@@ -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);
 
index 99b5a78794ce51b2b7b4baf7ac0591d91561c239..b752ad39887f6557af6e74828a75474c2a86debe 100644 (file)
@@ -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:
index eb743e0a344714daa1b34d51b262681f958479c5..d2ff528ebd4c8eba47add3861edc0bfd05c17de5 100644 (file)
@@ -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();