Don't refresh not yet realized widget in wxGTK wxDataViewCtrl.
If the text of any of wxDataViewCtrl cells was set before the control was realized (e.g. during its creation), the code tried to refresh the not yet shown widget resulting in GTK+ errors. Avoid this by only refreshing the tree if it's realized. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
dbab29b925
commit
b30ad9676b
@ -1644,23 +1644,28 @@ bool wxGtkDataViewModelNotifier::ValueChanged( const wxDataViewItem &item, unsig
|
||||
GtkTreeView *widget = GTK_TREE_VIEW(ctrl->GtkGetTreeView());
|
||||
GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
|
||||
|
||||
// Get cell area
|
||||
GtkTreeIter iter;
|
||||
iter.stamp = wxgtk_model->stamp;
|
||||
iter.user_data = (gpointer) item.GetID();
|
||||
wxGtkTreePath path(wxgtk_tree_model_get_path(
|
||||
GTK_TREE_MODEL(wxgtk_model), &iter ));
|
||||
GdkRectangle cell_area;
|
||||
gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area );
|
||||
// Don't attempt to refresh not yet realized tree, it is useless
|
||||
// and results in GTK errors.
|
||||
if ( gtk_widget_get_realized(ctrl->GtkGetTreeView()) )
|
||||
{
|
||||
// Get cell area
|
||||
GtkTreeIter iter;
|
||||
iter.stamp = wxgtk_model->stamp;
|
||||
iter.user_data = (gpointer) item.GetID();
|
||||
wxGtkTreePath path(wxgtk_tree_model_get_path(
|
||||
GTK_TREE_MODEL(wxgtk_model), &iter ));
|
||||
GdkRectangle cell_area;
|
||||
gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area );
|
||||
|
||||
GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
|
||||
double d = gtk_adjustment_get_value( hadjust );
|
||||
int xdiff = (int) d;
|
||||
GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
|
||||
double d = gtk_adjustment_get_value( hadjust );
|
||||
int xdiff = (int) d;
|
||||
|
||||
int ydiff = gcolumn->button->allocation.height;
|
||||
// Redraw
|
||||
gtk_widget_queue_draw_area( GTK_WIDGET(widget),
|
||||
cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height );
|
||||
int ydiff = gcolumn->button->allocation.height;
|
||||
// Redraw
|
||||
gtk_widget_queue_draw_area( GTK_WIDGET(widget),
|
||||
cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height );
|
||||
}
|
||||
|
||||
m_internal->ValueChanged( item, model_column );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user