@@ -1969,16 +1969,21 @@ static void _pop_menu_dictionary_edit_tag(GtkWidget *menuitem, dt_lib_module_t *
1969
1969
// update the store
1970
1970
GtkTreeModel * store = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model ));
1971
1971
dt_tag_op_t * to = g_malloc (sizeof (dt_tag_op_t ));
1972
- to -> tree_flag = d -> tree_flag ;
1973
- to -> oldtagname = tagname ;
1974
- to -> newtagname = new_prefix_tag ;
1975
- gint sort_column ;
1976
- GtkSortType sort_order ;
1977
- gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (store ), & sort_column , & sort_order );
1978
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store ), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID , GTK_SORT_ASCENDING );
1979
- gtk_tree_model_foreach (store , (GtkTreeModelForeachFunc )_update_tag_name_per_name , to );
1980
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store ), sort_column , sort_order );
1981
- g_free (to );
1972
+ if (to )
1973
+ {
1974
+ to -> tree_flag = d -> tree_flag ;
1975
+ to -> oldtagname = tagname ;
1976
+ to -> newtagname = new_prefix_tag ;
1977
+ gint sort_column ;
1978
+ GtkSortType sort_order ;
1979
+ gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (store ), & sort_column , & sort_order );
1980
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store ),
1981
+ GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID ,
1982
+ GTK_SORT_ASCENDING );
1983
+ gtk_tree_model_foreach (store , (GtkTreeModelForeachFunc )_update_tag_name_per_name , to );
1984
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store ), sort_column , sort_order );
1985
+ g_free (to );
1986
+ }
1982
1987
if (subtag ) g_free (new_prefix_tag );
1983
1988
1984
1989
_raise_signal_tag_changed (self );
@@ -2342,9 +2347,12 @@ static void _pop_menu_dictionary(GtkWidget *treeview, GdkEventButton *event, dt_
2342
2347
if (d -> collection [0 ])
2343
2348
{
2344
2349
char * collection = g_malloc (4096 );
2345
- dt_collection_serialize (collection , 4096 , FALSE);
2346
- if (g_strcmp0 (d -> collection , collection ) == 0 ) d -> collection [0 ] = '\0' ;
2347
- g_free (collection );
2350
+ if (collection )
2351
+ {
2352
+ dt_collection_serialize (collection , 4096 , FALSE);
2353
+ if (g_strcmp0 (d -> collection , collection ) == 0 ) d -> collection [0 ] = '\0' ;
2354
+ g_free (collection );
2355
+ }
2348
2356
}
2349
2357
if (count || d -> collection [0 ])
2350
2358
{
0 commit comments