From c84f22b5ca1781076f52834eb466e43e9dbd2720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 12 Dec 2007 11:50:05 +0000 Subject: [PATCH] * src/frontends/controllers/ControlCitation.cpp: - catch exception from boost::regex (bug 4421) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@22100 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ControlCitation.cpp | 17 +++++++++++++---- status.15x | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/frontends/controllers/ControlCitation.cpp b/src/frontends/controllers/ControlCitation.cpp index 8a3a7134ce..66ec37e5c3 100644 --- a/src/frontends/controllers/ControlCitation.cpp +++ b/src/frontends/controllers/ControlCitation.cpp @@ -15,7 +15,7 @@ #include "Buffer.h" #include "BufferParams.h" -#include "debug.h" // temporary +#include "debug.h" #include "support/lstrings.h" @@ -137,8 +137,16 @@ vector ControlCitation::searchKeys( // it is treated as a simple string by boost::regex. expr = escape_special_chars(expr); - boost::regex reg_exp(to_utf8(expr), case_sensitive? - boost::regex_constants::normal : boost::regex_constants::icase); + boost::regex reg_exp; + try { + reg_exp.assign(to_utf8(expr), case_sensitive ? + boost::regex_constants::normal : boost::regex_constants::icase); + } catch (boost::regex_error & e) { + // boost::regex throws an exception if the regular expression is not + // valid. + LYXERR(Debug::GUI) << e.what() << std::endl; + return vector(); + } vector::const_iterator it = keys_to_search.begin(); vector::const_iterator end = keys_to_search.end(); @@ -157,7 +165,8 @@ vector ControlCitation::searchKeys( if (boost::regex_search(data, reg_exp)) foundKeys.push_back(*it); } - catch (boost::regex_error &) { + catch (boost::regex_error & e) { + LYXERR(Debug::GUI) << e.what() << std::endl; return vector(); } } diff --git a/status.15x b/status.15x index f99479b05c..dfffb6a60f 100644 --- a/status.15x +++ b/status.15x @@ -157,6 +157,8 @@ What's new - Fix a crash when inserting a file in a tabular cell via Insert->File->Plain Text... +- Fix a crash when using the regex search of the citation dialog (bug 4421). + - Correctly adjust screen fonts after the zoom or dpi settings were changed in the preferences (Mac and Windows only) (bug 4268).