Skip to content

Commit f9bae2f

Browse files
committed
pathbar: increase reference count of path in update_button_types
Stop crash and g_object_ref: assertion 'G_IS_OBJECT (object)' failed warnings on toggling desktop_is_home_dir and on some window opening events
1 parent acdb7e2 commit f9bae2f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/caja-pathbar.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,17 @@ update_button_types (CajaPathBar *path_bar)
169169
button_data = BUTTON_DATA (list->data);
170170
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button)))
171171
{
172-
path = button_data->path;
172+
/*Increase the reference count on path so it does not get cleared
173+
*by caja_path_bar_clear_buttons during caja_path_bar_update_path
174+
*/
175+
path = g_object_ref (button_data->path);
173176
break;
174177
}
175178
}
176179
if (path != NULL)
177180
{
178181
caja_path_bar_update_path (path_bar, path, TRUE);
182+
g_object_unref (path);
179183
}
180184
}
181185

@@ -2103,6 +2107,7 @@ caja_path_bar_update_path (CajaPathBar *path_bar,
21032107
}
21042108

21052109
path_bar->current_path = g_object_ref (file_path);
2110+
21062111
path_bar->current_button_data = current_button_data;
21072112

21082113
return result;

0 commit comments

Comments
 (0)