glom r1538 - in trunk: . glom/utility_widgets/db_adddel
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1538 - in trunk: . glom/utility_widgets/db_adddel
- Date: Wed, 9 Apr 2008 13:21:36 +0100 (BST)
Author: murrayc
Date: Wed Apr 9 13:21:36 2008
New Revision: 1538
URL: http://svn.gnome.org/viewvc/glom?rev=1538&view=rev
Log:
2008-04-09 Murray Cumming <murrayc murrayc com>
* glom/utility_widgets/db_adddel/db_adddel.cc
get_item_placeholder(), Glom.get_item_selected(),
on_cell_layout_button_clicked(), remove_item(),
on_treeview_cell_edited_bool(), on_treeview_cell_edited(),
on_treeview_button_press_event(), get_last_row(),
get_last_row, set_value_key(), get_is_placeholder_row,()
on_cell_button_clicked(): Check that the treemodel is not null before
dereferencing it.
This fixes a crash when trying to add a record when there is no
primary key.
Bug #527007 (Jean-FranÃois Fortin Tam)
Modified:
trunk/ChangeLog
trunk/glom/utility_widgets/db_adddel/db_adddel.cc
Modified: trunk/glom/utility_widgets/db_adddel/db_adddel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/db_adddel.cc (original)
+++ trunk/glom/utility_widgets/db_adddel/db_adddel.cc Wed Apr 9 13:21:36 2008
@@ -361,7 +361,10 @@
Gtk::TreeModel::iterator DbAddDel::get_item_placeholder()
{
//Get the existing placeholder row, or add one if necessary:
- return m_refListStore->get_placeholder_row();
+ if(m_refListStore)
+ return m_refListStore->get_placeholder_row();
+ else
+ return Gtk::TreeModel::iterator();
}
Gnome::Gda::Value DbAddDel::get_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem_Field>& layout_item)
@@ -412,7 +415,10 @@
return refTreeSelection->get_selected();
}
- return m_refListStore->children().end();
+ if(m_refListStore)
+ return m_refListStore->children().end();
+ else
+ return Gtk::TreeModel::iterator();
}
@@ -566,6 +572,9 @@
void DbAddDel::on_cell_layout_button_clicked(const Gtk::TreeModel::Path& path, int model_column_index)
{
+ if(!m_refListStore)
+ return;
+
Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
if(iter)
{
@@ -1305,7 +1314,7 @@
void DbAddDel::remove_item(const Gtk::TreeModel::iterator& iter)
{
- if(iter)
+ if(iter && m_refListStore)
m_refListStore->erase(iter);
}
@@ -1365,6 +1374,9 @@
if(path_string.empty())
return;
+ if(!m_refListStore)
+ return;
+
const Gtk::TreePath path(path_string);
//Get the row from the path:
@@ -1392,7 +1404,7 @@
bool bIsAdd = false;
bool bIsChange = false;
- int iCount = m_refListStore->children().size();
+ const int iCount = m_refListStore->children().size();
if(iCount)
{
if(get_allow_user_actions()) //If add is possible:
@@ -1445,6 +1457,9 @@
if(path_string.empty())
return;
+ if(!m_refListStore)
+ return;
+
const Gtk::TreePath path(path_string);
//Get the row from the path:
@@ -1648,6 +1663,9 @@
//Get the row:
if(row_exists && m_refListStore)
{
+ if(!m_refListStore)
+ return;
+
Gtk::TreeModel::iterator iterRow = m_refListStore->get_iter(path);
if(iterRow)
{
@@ -1849,12 +1867,18 @@
Gtk::TreeModel::iterator DbAddDel::get_last_row() const
{
- return m_refListStore->get_last_row();
+ if(m_refListStore)
+ return m_refListStore->get_last_row();
+ else
+ return Gtk::TreeModel::iterator();
}
Gtk::TreeModel::iterator DbAddDel::get_last_row()
{
- return m_refListStore->get_last_row();
+ if(m_refListStore)
+ return m_refListStore->get_last_row();
+ else
+ return Gtk::TreeModel::iterator();
}
Gnome::Gda::Value DbAddDel::get_value_key(const Gtk::TreeModel::iterator& iter)
@@ -1865,7 +1889,7 @@
void DbAddDel::set_value_key(const Gtk::TreeModel::iterator& iter, const Gnome::Gda::Value& value)
{
- if(iter)
+ if(iter && m_refListStore)
{
Gtk::TreeModel::Row row = *iter;
@@ -1892,6 +1916,9 @@
if(!iter)
return false;
+ if(!m_refListStore)
+ return false;
+
if(iter == m_refListStore->children().end())
{
return false;
@@ -2054,6 +2081,9 @@
void DbAddDel::on_cell_button_clicked(const Gtk::TreeModel::Path& path)
{
+ if(!m_refListStore)
+ return;
+
Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
if(iter)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]