]> git.lyx.org Git - lyx.git/commitdiff
Fix bug #8166: Crash on clicking away from empty paragraph
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 22 May 2012 23:31:43 +0000 (01:31 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 22 May 2012 23:31:43 +0000 (01:31 +0200)
We rely on the 'or' operator to prevent us from calling
'notifyCursorLeaves' if one of the two cursors is broken. This doesn't
work when using the '|' operator. The compiler 'optimizes' the code in
such a way that we always call notifyCursorLeaves anyway. Using the '||'
operator fixes this.

src/BufferView.cpp

index a30c0f0c2fdc8545d8125c61360b2c34a3888c0d..1017cea7c0212428c307cdfec50342d46453094a 100644 (file)
@@ -2201,8 +2201,8 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
 
        // Notify left insets
        if (cur != old) {
-               bool badcursor = old.fixIfBroken() | cur.fixIfBroken()
-                               | notifyCursorLeavesOrEnters(old, cur);
+               bool badcursor = old.fixIfBroken() || cur.fixIfBroken()
+                               || notifyCursorLeavesOrEnters(old, cur);
                if (badcursor)
                        cursor().fixIfBroken();
        }