Skip to content

Commit

Permalink
Merge pull request #1339 from gkatev/codenav_fix_old_model_segv
Browse files Browse the repository at this point in the history
codenav/goto_file: Fix use-after-free crash
  • Loading branch information
eht16 authored May 19, 2024
2 parents 51ed8e4 + adaceb6 commit 6e0cb58
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions codenav/src/goto_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion)
if (old_model != NULL)
{ /* Restore the no-sub-directory model */
log_debug("Restoring old model!");

gtk_entry_completion_set_model (completion, old_model);
g_object_unref(old_model);
old_model = NULL;

g_free(curr_dir);
curr_dir = NULL;
}
Expand All @@ -185,7 +188,10 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion)

/* Save the completion_mode for future restore. */
if (old_model == NULL)
{
old_model = gtk_entry_completion_get_model(completion);
g_object_ref(old_model);
}

log_debug("New completion list!");

Expand Down

0 comments on commit 6e0cb58

Please sign in to comment.