From 77d1b260e5da73d6a4e3d04252c3ab5a38439d95 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 27 Sep 2024 15:01:22 +0600 Subject: [PATCH 1/2] Test fix for crash --- source/ubl-settings-usergroups.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index ab42b25..9153e51 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -27,7 +27,6 @@ int yon_load_proceed(YON_CONFIG_TYPE type){ if (strstr(key,USERADD_SEARCH_macro)&&local_value){ if (parsed_size>5){ char *temp = yon_char_append(local_value,parsed[5]); - free(local_value); local_value=temp; yon_config_set(key,yon_char_new(local_value)); yon_config_set_status(key,0); @@ -2635,7 +2634,6 @@ void on_main_edit(GtkWidget *self, main_window *widgets){ if (strstr(usershadow_sync,"shutdown")){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck),1); } - free(usershadow_sync); } } From c03af969ddd070f01b09d35a469e469d3b5f94ad Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 27 Sep 2024 16:18:18 +0600 Subject: [PATCH 2/2] Fixed --shell loading at user editing window --- source/ubl-settings-usergroups.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 9153e51..bbbba4c 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -2280,10 +2280,8 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); if (user_shell_active>0){ - user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL); - if (!strcmp(user_shell,SET_LABEL)){ - user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL); - } + user_shell = yon_char_unite("--shell ",!strcmp(gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->userShellCombo)),"Set")?(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)):(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL); + } else user_shell=""; int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); @@ -2401,11 +2399,11 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ if (shells[i][strlen(shells[i])-1]=='\n') shells[i][strlen(shells[i])-1]='\0'; int parsed_size=0; config_str parsed = yon_char_parse(shells[i],&parsed_size,";"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->userShellCombo),parsed[0]); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->userShellCombo),parsed[0],parsed[0]); yon_char_parsed_free(parsed,parsed_size); } } - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->userShellCombo),SET_LABEL); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->userShellCombo),"Set",SET_LABEL); yon_char_parsed_free(shells,shell_size); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userShellCombo),0); window->old_password=NULL; @@ -2556,8 +2554,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){ gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2); i++; } else if (!strcmp(parameters_substring[i],"--shell")||!strcmp(parameters_substring[i],"-s")){ - int active = yon_gtk_combo_box_text_find(window->userShellCombo,parameters_substring[i+1]); - if (!active){ + if (!gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),parameters_substring[i+1])){ gtk_entry_set_text(GTK_ENTRY(window->userShellEntry),parameters_substring[i+1]); gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),"Set"); }