diff options
author | Dave Davenport <qball@gmpclient.org> | 2018-03-07 21:24:37 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2018-03-07 21:24:37 +0100 |
commit | 7f83fa3dd3f8bd1af96faca3fcd7137ca55f7bb3 (patch) | |
tree | a893e1b4eea604493b1ba5f530e3c86be3651a30 /source/dialogs/ssh.c | |
parent | 6efd73ff92239de8ed1f0b0ac2e34624d8fc9fa4 (diff) | |
parent | d9d3724615d393d82da3f0913eb06447771fb171 (diff) |
Merge branch 'next' of github:DaveDavenport/rofi into next
Diffstat (limited to 'source/dialogs/ssh.c')
-rw-r--r-- | source/dialogs/ssh.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 8b20ccb8..4f9bb46f 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -433,6 +433,20 @@ static unsigned int ssh_mode_get_num_entries ( const Mode *sw ) const SSHModePrivateData *rmpd = (const SSHModePrivateData *) mode_get_private_data ( sw ); return rmpd->hosts_list_length; } +/** + * @param sw Object handle to the SSH Mode object + * + * Cleanup the SSH Mode. Free all allocated memory and NULL the private data pointer. + */ +static void ssh_mode_destroy ( Mode *sw ) +{ + SSHModePrivateData *rmpd = (SSHModePrivateData *) mode_get_private_data ( sw ); + if ( rmpd != NULL ) { + g_strfreev ( rmpd->hosts_list ); + g_free ( rmpd ); + mode_set_private_data ( sw, NULL ); + } +} /** * @param sw Object handle to the SSH Mode object @@ -465,29 +479,14 @@ static ModeMode ssh_mode_result ( Mode *sw, int mretv, char **input, unsigned in } else if ( ( mretv & MENU_ENTRY_DELETE ) && rmpd->hosts_list[selected_line] ) { delete_ssh ( rmpd->hosts_list[selected_line] ); - g_strfreev ( rmpd->hosts_list ); - rmpd->hosts_list_length = 0; - rmpd->hosts_list = NULL; // Stay retv = RELOAD_DIALOG; + ssh_mode_destroy ( sw ); + ssh_mode_init ( sw ); } return retv; } -/** - * @param sw Object handle to the SSH Mode object - * - * Cleanup the SSH Mode. Free all allocated memory and NULL the private data pointer. - */ -static void ssh_mode_destroy ( Mode *sw ) -{ - SSHModePrivateData *rmpd = (SSHModePrivateData *) mode_get_private_data ( sw ); - if ( rmpd != NULL ) { - g_strfreev ( rmpd->hosts_list ); - g_free ( rmpd ); - mode_set_private_data ( sw, NULL ); - } -} /** * @param sw Object handle to the SSH Mode object |