From: Bo Peng Date: Sun, 7 Jan 2007 22:41:54 +0000 (+0000) Subject: Fix bug 3062, bookmark-goto x crashes lyx for invalid bookmark X-Git-Tag: 1.6.10~11272 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=57686e9d61ee444ced63e02745f56f3465cbf116;p=features.git Fix bug 3062, bookmark-goto x crashes lyx for invalid bookmark * src/session.C: check validity of temp bookmark * src/lyxfunc.C: check validity of bookmark in GOTO_BOOKMARK * lib/bind/*.bind: remove shortcuts to bookmark-save 2/3/4/5 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16589 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind index 78498fd7d2..e0c0b5b313 100644 --- a/lib/bind/cua.bind +++ b/lib/bind/cua.bind @@ -168,10 +168,6 @@ \bind "C-~S-4" "bookmark-goto 4" \bind "C-~S-5" "bookmark-goto 5" \bind "C-M-~S-1" "bookmark-save 1" -\bind "C-M-~S-2" "bookmark-save 2" -\bind "C-M-~S-3" "bookmark-save 3" -\bind "C-M-~S-4" "bookmark-save 4" -\bind "C-M-~S-5" "bookmark-save 5" # diff --git a/lib/bind/emacs.bind b/lib/bind/emacs.bind index cd7a0fac13..da23e89026 100644 --- a/lib/bind/emacs.bind +++ b/lib/bind/emacs.bind @@ -158,10 +158,6 @@ \bind "C-~S-4" "bookmark-goto 4" \bind "C-~S-5" "bookmark-goto 5" \bind "C-M-~S-1" "bookmark-save 1" -\bind "C-M-~S-2" "bookmark-save 2" -\bind "C-M-~S-3" "bookmark-save 3" -\bind "C-M-~S-4" "bookmark-save 4" -\bind "C-M-~S-5" "bookmark-save 5" # The below are xemacs bindings #\bind "Home" "line-begin" diff --git a/lib/bind/mac.bind b/lib/bind/mac.bind index 9781eff770..9d1f3ebd06 100644 --- a/lib/bind/mac.bind +++ b/lib/bind/mac.bind @@ -155,10 +155,6 @@ \bind "C-~S-4" "bookmark-goto 4" \bind "C-~S-5" "bookmark-goto 5" \bind "C-M-~S-1" "bookmark-save 1" -\bind "C-M-~S-2" "bookmark-save 2" -\bind "C-M-~S-3" "bookmark-save 3" -\bind "C-M-~S-4" "bookmark-save 4" -\bind "C-M-~S-5" "bookmark-save 5" # diff --git a/lib/bind/xemacs.bind b/lib/bind/xemacs.bind index 03c54cfe48..6af4a10082 100644 --- a/lib/bind/xemacs.bind +++ b/lib/bind/xemacs.bind @@ -173,10 +173,6 @@ \bind "C-~S-4" "bookmark-goto 4" \bind "C-~S-5" "bookmark-goto 5" \bind "C-M-~S-1" "bookmark-save 1" -\bind "C-M-~S-2" "bookmark-save 2" -\bind "C-M-~S-3" "bookmark-save 3" -\bind "C-M-~S-4" "bookmark-save 4" -\bind "C-M-~S-5" "bookmark-save 5" # # Motion + select group diff --git a/src/lyxfunc.C b/src/lyxfunc.C index a631c42d35..09307e9366 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1673,6 +1673,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd) case LFUN_BOOKMARK_GOTO: { BOOST_ASSERT(lyx_view_); unsigned int idx = convert(to_utf8(cmd.argument())); + if (!LyX::ref().session().bookmarks().isValid(idx)) + break; BookmarksSection::Bookmark const bm = LyX::ref().session().bookmarks().bookmark(idx); BOOST_ASSERT(!bm.filename.empty()); string const file = bm.filename.absFilename(); diff --git a/src/session.C b/src/session.C index 8ecbb5255d..7078a2a734 100644 --- a/src/session.C +++ b/src/session.C @@ -296,8 +296,10 @@ void BookmarksSection::save(FileName const & fname, int par_id, pos_type par_pos bool BookmarksSection::isValid(unsigned int i) const { - // i == 0, or in the queue - return i <= bookmarks.size(); + if (i == 0) + return !temp_bookmark.filename.empty(); + else + return i <= bookmarks.size() && !bookmarks[i-1].filename.empty(); }