comment out wxPrintf/wxLogDebug calls; fix some indentations; comment out the (debug) code explicitly crashing the application; protect with wxASSERTs the FindNode() return values, before they are dereferenced
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -220,7 +220,6 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGtkTreeModelNode* GetParent()
|
wxGtkTreeModelNode* GetParent()
|
||||||
@@ -230,8 +229,8 @@ public:
|
|||||||
wxGtkTreeModelChildren &GetChildren()
|
wxGtkTreeModelChildren &GetChildren()
|
||||||
{ return m_children; }
|
{ return m_children; }
|
||||||
|
|
||||||
unsigned int GetChildCount() { return m_children.GetCount(); }
|
unsigned int GetChildCount() const { return m_children.GetCount(); }
|
||||||
unsigned int GetNodesCount() { return m_nodes.GetCount(); }
|
unsigned int GetNodesCount() const { return m_nodes.GetCount(); }
|
||||||
|
|
||||||
wxDataViewItem &GetItem() { return m_item; }
|
wxDataViewItem &GetItem() { return m_item; }
|
||||||
wxDataViewCtrlInternal *GetInternal() { return m_internal; }
|
wxDataViewCtrlInternal *GetInternal() { return m_internal; }
|
||||||
@@ -535,8 +534,6 @@ wxgtk_tree_model_get_column_type (GtkTreeModel *tree_model,
|
|||||||
|
|
||||||
wxString wxtype = wxtree_model->internal->GetDataViewModel()->GetColumnType( (unsigned int) index );
|
wxString wxtype = wxtree_model->internal->GetDataViewModel()->GetColumnType( (unsigned int) index );
|
||||||
|
|
||||||
wxPrintf( "get_column_type %s\n", wxtype );
|
|
||||||
|
|
||||||
if (wxtype == wxT("string"))
|
if (wxtype == wxT("string"))
|
||||||
gtype = G_TYPE_STRING;
|
gtype = G_TYPE_STRING;
|
||||||
else
|
else
|
||||||
@@ -603,8 +600,9 @@ wxgtk_tree_model_iter_next (GtkTreeModel *tree_model,
|
|||||||
{
|
{
|
||||||
GtkWxTreeModel *wxtree_model = (GtkWxTreeModel *) tree_model;
|
GtkWxTreeModel *wxtree_model = (GtkWxTreeModel *) tree_model;
|
||||||
|
|
||||||
if (wxtree_model->stamp != iter->stamp)
|
//if (wxtree_model->stamp != iter->stamp)
|
||||||
wxPrintf( "crash\n" );
|
// wxPrintf( "crash\n" );
|
||||||
|
// TODO: remove this code
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (wxtree_model), FALSE);
|
g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (wxtree_model), FALSE);
|
||||||
g_return_val_if_fail (wxtree_model->stamp == iter->stamp, FALSE);
|
g_return_val_if_fail (wxtree_model->stamp == iter->stamp, FALSE);
|
||||||
@@ -809,24 +807,27 @@ wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable,
|
|||||||
gint WXUNUSED(sort_column_id),
|
gint WXUNUSED(sort_column_id),
|
||||||
GtkTreeIterCompareFunc func,
|
GtkTreeIterCompareFunc func,
|
||||||
gpointer WXUNUSED(data),
|
gpointer WXUNUSED(data),
|
||||||
GtkDestroyNotify WXUNUSED(destroy) )
|
GtkDestroyNotify WXUNUSED(destroy))
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
|
g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
|
||||||
g_return_if_fail (func != NULL);
|
g_return_if_fail (func != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable,
|
static void
|
||||||
|
wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable,
|
||||||
GtkTreeIterCompareFunc func,
|
GtkTreeIterCompareFunc func,
|
||||||
gpointer WXUNUSED(data),
|
gpointer WXUNUSED(data),
|
||||||
GtkDestroyNotify WXUNUSED(destroy) )
|
GtkDestroyNotify WXUNUSED(destroy))
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
|
g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
|
||||||
g_return_if_fail (func != NULL);
|
g_return_if_fail (func != NULL);
|
||||||
|
|
||||||
wxPrintf( "wxgtk_tree_model_set_default_sort_func\n" );
|
//wxPrintf( "wxgtk_tree_model_set_default_sort_func\n" );
|
||||||
|
// TODO: remove this code
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean wxgtk_tree_model_has_default_sort_func (GtkTreeSortable *sortable)
|
static gboolean
|
||||||
|
wxgtk_tree_model_has_default_sort_func (GtkTreeSortable *sortable)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (sortable), FALSE );
|
g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (sortable), FALSE );
|
||||||
|
|
||||||
@@ -1106,7 +1107,7 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer,
|
|||||||
wxWindowDC* dc = (wxWindowDC*) cell->GetDC();
|
wxWindowDC* dc = (wxWindowDC*) cell->GetDC();
|
||||||
wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl();
|
wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl();
|
||||||
|
|
||||||
// Reinitilise DC if drawing occurs into a different
|
// Reinitialize wxWindowDC's GDK window if drawing occurs into a different
|
||||||
// window such as a DnD drop window.
|
// window such as a DnD drop window.
|
||||||
if (window != impl->m_gdkwindow)
|
if (window != impl->m_gdkwindow)
|
||||||
{
|
{
|
||||||
@@ -2125,7 +2126,9 @@ bool wxDataViewChoiceRenderer::GetValue( wxVariant &value ) const
|
|||||||
const_cast<wxDataViewChoiceRenderer*>(this)->GetOwner()->GetOwner()->GetFont() );
|
const_cast<wxDataViewChoiceRenderer*>(this)->GetOwner()->GetOwner()->GetFont() );
|
||||||
g_value_unset( &gvalue );
|
g_value_unset( &gvalue );
|
||||||
value = temp;
|
value = temp;
|
||||||
wxPrintf( "temp %s\n", temp );
|
|
||||||
|
//wxPrintf( "temp %s\n", temp );
|
||||||
|
// TODO: remove this code
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -3109,6 +3112,9 @@ bool wxDataViewCtrlInternal::ItemAdded( const wxDataViewItem &parent, const wxDa
|
|||||||
if (!m_wx_model->IsVirtualListModel())
|
if (!m_wx_model->IsVirtualListModel())
|
||||||
{
|
{
|
||||||
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
||||||
|
wxASSERT_MSG(parent_node,
|
||||||
|
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
|
||||||
|
|
||||||
if (m_wx_model->IsContainer( item ))
|
if (m_wx_model->IsContainer( item ))
|
||||||
parent_node->AddNode( new wxGtkTreeModelNode( parent_node, item, this ) );
|
parent_node->AddNode( new wxGtkTreeModelNode( parent_node, item, this ) );
|
||||||
else
|
else
|
||||||
@@ -3123,6 +3129,9 @@ bool wxDataViewCtrlInternal::ItemDeleted( const wxDataViewItem &parent, const wx
|
|||||||
if (!m_wx_model->IsVirtualListModel())
|
if (!m_wx_model->IsVirtualListModel())
|
||||||
{
|
{
|
||||||
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
||||||
|
wxASSERT_MSG(parent_node,
|
||||||
|
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
|
||||||
|
|
||||||
parent_node->DeleteChild( item.GetID() );
|
parent_node->DeleteChild( item.GetID() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3305,6 +3314,9 @@ gboolean wxDataViewCtrlInternal::iter_children( GtkTreeIter *iter, GtkTreeIter *
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
||||||
|
wxASSERT_MSG(parent_node,
|
||||||
|
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
|
||||||
|
|
||||||
BuildBranch( parent_node );
|
BuildBranch( parent_node );
|
||||||
|
|
||||||
if (parent_node->GetChildCount() == 0)
|
if (parent_node->GetChildCount() == 0)
|
||||||
@@ -3334,6 +3346,9 @@ gboolean wxDataViewCtrlInternal::iter_has_child( GtkTreeIter *iter )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wxGtkTreeModelNode *node = FindNode( iter );
|
wxGtkTreeModelNode *node = FindNode( iter );
|
||||||
|
wxASSERT_MSG(node,
|
||||||
|
"Did you forget a call to ItemAdded()? The iterator is unknown to the wxGtkTreeModel");
|
||||||
|
|
||||||
BuildBranch( node );
|
BuildBranch( node );
|
||||||
|
|
||||||
return (node->GetChildCount() > 0);
|
return (node->GetChildCount() > 0);
|
||||||
@@ -3362,6 +3377,9 @@ gint wxDataViewCtrlInternal::iter_n_children( GtkTreeIter *iter )
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wxGtkTreeModelNode *parent_node = FindNode( iter );
|
wxGtkTreeModelNode *parent_node = FindNode( iter );
|
||||||
|
wxASSERT_MSG(parent_node,
|
||||||
|
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
|
||||||
|
|
||||||
BuildBranch( parent_node );
|
BuildBranch( parent_node );
|
||||||
|
|
||||||
// wxPrintf( "iter_n_children %d\n", parent_node->GetChildCount() );
|
// wxPrintf( "iter_n_children %d\n", parent_node->GetChildCount() );
|
||||||
@@ -3400,6 +3418,9 @@ gboolean wxDataViewCtrlInternal::iter_nth_child( GtkTreeIter *iter, GtkTreeIter
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
||||||
|
wxASSERT_MSG(parent_node,
|
||||||
|
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
|
||||||
|
|
||||||
BuildBranch( parent_node );
|
BuildBranch( parent_node );
|
||||||
|
|
||||||
// wxPrintf( "iter_nth_child %d\n", n );
|
// wxPrintf( "iter_nth_child %d\n", n );
|
||||||
@@ -3487,12 +3508,15 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( GtkTreeIter *iter )
|
|||||||
|
|
||||||
wxGtkTreeModelNode *result = wxDataViewCtrlInternal_FindNode( m_wx_model, m_root, item );
|
wxGtkTreeModelNode *result = wxDataViewCtrlInternal_FindNode( m_wx_model, m_root, item );
|
||||||
|
|
||||||
|
/*
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
wxLogDebug( "Not found %p", iter->user_data );
|
wxLogDebug( "Not found %p", iter->user_data );
|
||||||
char *crash = NULL;
|
char *crash = NULL;
|
||||||
*crash = 0;
|
*crash = 0;
|
||||||
}
|
}
|
||||||
|
// TODO: remove this code
|
||||||
|
*/
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3504,12 +3528,15 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( const wxDataViewItem &item
|
|||||||
|
|
||||||
wxGtkTreeModelNode *result = wxDataViewCtrlInternal_FindNode( m_wx_model, m_root, item );
|
wxGtkTreeModelNode *result = wxDataViewCtrlInternal_FindNode( m_wx_model, m_root, item );
|
||||||
|
|
||||||
|
/*
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
wxLogDebug( "Not found %p", item.GetID() );
|
wxLogDebug( "Not found %p", item.GetID() );
|
||||||
char *crash = NULL;
|
char *crash = NULL;
|
||||||
*crash = 0;
|
*crash = 0;
|
||||||
}
|
}
|
||||||
|
// TODO: remove this code
|
||||||
|
*/
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user