[gtkmm/gtkmm-3-20: 1/3] TreeView: _auto_store_on_cellrenderer_text_edited_numerical():
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-3-20: 1/3] TreeView: _auto_store_on_cellrenderer_text_edited_numerical():
- Date: Thu, 14 Apr 2016 16:12:38 +0000 (UTC)
commit 4c99f24014b16a18d15aab0867543ccb9eaa0da0
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Apr 14 15:03:05 2016 +0200
TreeView: _auto_store_on_cellrenderer_text_edited_numerical():
Catch the exception from std::stod().
This is a regression since version 3.17.80:
https://git.gnome.org/browse/gtkmm/commit/gtk/src/treeview.hg?id=fcc0f358d17264f8956567a33471a6b52c2fc0d1
Bug #765044 (Justinas)
gtk/src/treeview.hg | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index 178af31..75dd0e6 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -1185,7 +1185,15 @@ void _auto_store_on_cellrenderer_text_edited_numerical(const Glib::ustring& path
//new_value << astream; //Get it out of the stream as the numerical type.
//Convert the text to a number, using the same logic used by GtkCellRendererText when it stores
numbers.
- auto new_value = static_cast<ColumnType>( std::stod(new_text) );
+ ColumnType new_value = ColumnType();
+ try
+ {
+ new_value = static_cast<ColumnType>( std::stod(new_text) );
+ } catch(const std::invalid_argument&)
+ {
+ //Intentionally ignored.
+ //Applications can use their own logic if they want to handle invalid input differently.
+ }
//Store the user's new text in the model:
Gtk::TreeRow row = *iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]