mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
fix gtk critical errors
This commit is contained in:
parent
5f9d39ef8d
commit
71fb14bce1
2 changed files with 23 additions and 9 deletions
|
@ -85,6 +85,8 @@ initCairo( GtkDrawCtx* dctx )
|
||||||
|
|
||||||
if ( !!dctx->surface ) {
|
if ( !!dctx->surface ) {
|
||||||
cairo = cairo_create( dctx->surface );
|
cairo = cairo_create( dctx->surface );
|
||||||
|
cairo_surface_destroy( dctx->surface );
|
||||||
|
// XP_ASSERT( 0 );
|
||||||
} else if ( !!dctx->drawing_area ) {
|
} else if ( !!dctx->drawing_area ) {
|
||||||
#ifdef GDK_AVAILABLE_IN_3_22
|
#ifdef GDK_AVAILABLE_IN_3_22
|
||||||
GdkWindow* window = gtk_widget_get_window( dctx->drawing_area );
|
GdkWindow* window = gtk_widget_get_window( dctx->drawing_area );
|
||||||
|
@ -115,12 +117,16 @@ destroyCairo( GtkDrawCtx* dctx )
|
||||||
{
|
{
|
||||||
/* XP_LOGF( "%s(dctx=%p)", __func__, dctx ); */
|
/* XP_LOGF( "%s(dctx=%p)", __func__, dctx ); */
|
||||||
XP_ASSERT( !!dctx->_cairo );
|
XP_ASSERT( !!dctx->_cairo );
|
||||||
|
if ( !!dctx->surface ) {
|
||||||
|
XP_LOGF( "%s(): have surface; doing nothing", __func__ );
|
||||||
|
} else {
|
||||||
#ifdef GDK_AVAILABLE_IN_3_22
|
#ifdef GDK_AVAILABLE_IN_3_22
|
||||||
GdkWindow* window = gtk_widget_get_window( dctx->drawing_area );
|
GdkWindow* window = gtk_widget_get_window( dctx->drawing_area );
|
||||||
gdk_window_end_draw_frame( window, dctx->dc );
|
gdk_window_end_draw_frame( window, dctx->dc );
|
||||||
#else
|
#else
|
||||||
cairo_destroy( dctx->_cairo );
|
cairo_destroy( dctx->_cairo );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
dctx->_cairo = NULL;
|
dctx->_cairo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +470,8 @@ gtk_draw_beginDraw( DrawCtx* p_dctx )
|
||||||
#ifdef USE_CAIRO
|
#ifdef USE_CAIRO
|
||||||
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
|
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
|
||||||
return initCairo( dctx );
|
return initCairo( dctx );
|
||||||
|
#else
|
||||||
|
fix this
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1509,7 +1517,7 @@ void
|
||||||
removeSurface( GtkDrawCtx* dctx )
|
removeSurface( GtkDrawCtx* dctx )
|
||||||
{
|
{
|
||||||
XP_ASSERT( !!dctx->surface );
|
XP_ASSERT( !!dctx->surface );
|
||||||
g_object_unref( dctx->surface );
|
cairo_surface_destroy( dctx->surface );
|
||||||
dctx->surface = NULL;
|
dctx->surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1534,6 +1542,8 @@ getImage( GtkDrawCtx* XP_UNUSED_DBG(dctx), XWStreamCtxt* XP_UNUSED_DBG(stream) )
|
||||||
cairo_surface_write_to_png_stream( dctx->surface,
|
cairo_surface_write_to_png_stream( dctx->surface,
|
||||||
write_func, stream );
|
write_func, stream );
|
||||||
XP_ASSERT( CAIRO_STATUS_SUCCESS == status );
|
XP_ASSERT( CAIRO_STATUS_SUCCESS == status );
|
||||||
|
#else
|
||||||
|
error Will Robinson
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,20 +216,24 @@ add_to_list( GtkWidget* list, sqlite3_int64 rowid, XP_Bool isNew,
|
||||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
|
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
|
||||||
GtkListStore* store = GTK_LIST_STORE( model );
|
GtkListStore* store = GTK_LIST_STORE( model );
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
if ( isNew ) {
|
XP_Bool found = XP_FALSE;
|
||||||
gtk_list_store_append( store, &iter );
|
if ( !isNew ) {
|
||||||
} else {
|
for ( gboolean valid = gtk_tree_model_get_iter_first( model, &iter );
|
||||||
gboolean valid;
|
|
||||||
for ( valid = gtk_tree_model_get_iter_first( model, &iter );
|
|
||||||
valid;
|
valid;
|
||||||
valid = gtk_tree_model_iter_next( model, &iter ) ) {
|
valid = gtk_tree_model_iter_next( model, &iter ) ) {
|
||||||
sqlite3_int64 tmpid;
|
sqlite3_int64 tmpid;
|
||||||
gtk_tree_model_get( model, &iter, ROW_ITEM, &tmpid, -1 );
|
gtk_tree_model_get( model, &iter, ROW_ITEM, &tmpid, -1 );
|
||||||
if ( tmpid == rowid ) {
|
if ( tmpid == rowid ) {
|
||||||
|
found = XP_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !found ) {
|
||||||
|
gtk_list_store_append( store, &iter );
|
||||||
|
}
|
||||||
|
|
||||||
gchar* localString = 0 <= gib->turn ? gib->turnLocal ? "YES"
|
gchar* localString = 0 <= gib->turn ? gib->turnLocal ? "YES"
|
||||||
: "NO" : "";
|
: "NO" : "";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue