Skip to content
Snippets Groups Projects
Commit 8ae44e7b authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#1923] Fix segmentation fault when adding a new account

parent d7a769c3
No related branches found
No related tags found
No related merge requests found
...@@ -157,6 +157,9 @@ static void iax_apply_callback( void ) { ...@@ -157,6 +157,9 @@ static void iax_apply_callback( void ) {
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username)))); g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server)))); g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password)))); g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password))));
//g_hash_table_insert(current->properties, g_strdup(ACCOUNT_RESOLVE_ONCE), g_strdup("FALSE"));
//g_hash_table_insert(current->properties, g_strdup(ACCOUNT_REGISTRATION_EXPIRE), g_strdup("600"));
dbus_add_account( current ); dbus_add_account( current );
getMessageSummary(message, getMessageSummary(message,
gtk_entry_get_text (GTK_ENTRY(wiz->iax_alias)), gtk_entry_get_text (GTK_ENTRY(wiz->iax_alias)),
......
...@@ -66,10 +66,11 @@ is_iax_enabled(void) ...@@ -66,10 +66,11 @@ is_iax_enabled(void)
return FALSE; return FALSE;
} }
static GtkWidget * createAccountTab(account_t * a) static GtkWidget * createAccountTab(account_t **a)
{ {
GtkWidget * frame; GtkWidget * frame;
GtkWidget * table; GtkWidget * table;
account_t *currentAccount;
#if GTK_CHECK_VERSION(2,16,0) #if GTK_CHECK_VERSION(2,16,0)
#else #else
GtkWidget *image; GtkWidget *image;
...@@ -87,12 +88,12 @@ static GtkWidget * createAccountTab(account_t * a) ...@@ -87,12 +88,12 @@ static GtkWidget * createAccountTab(account_t * a)
/* TODO: add curProxy, and add boxes for Proxy support */ /* TODO: add curProxy, and add boxes for Proxy support */
gchar * curMailbox = ""; gchar * curMailbox = "";
account_t * currentAccount = a; currentAccount = *a;
// Load from SIP/IAX/Unknown ? // Load from SIP/IAX/Unknown ?
if(a) if(currentAccount)
{ {
curAccountID = a->accountID; curAccountID = currentAccount->accountID;
curAccountType = g_hash_table_lookup(currentAccount->properties, ACCOUNT_TYPE); curAccountType = g_hash_table_lookup(currentAccount->properties, ACCOUNT_TYPE);
curAccountEnabled = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ENABLED); curAccountEnabled = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ENABLED);
curAlias = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ALIAS); curAlias = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ALIAS);
...@@ -221,19 +222,21 @@ static GtkWidget * createAccountTab(account_t * a) ...@@ -221,19 +222,21 @@ static GtkWidget * createAccountTab(account_t * a)
gtk_widget_show_all( table ); gtk_widget_show_all( table );
gtk_container_set_border_width (GTK_CONTAINER(table), 10); gtk_container_set_border_width (GTK_CONTAINER(table), 10);
*a = currentAccount;
return frame; return frame;
} }
GtkWidget * createAdvancedTab(account_t * a) GtkWidget * createAdvancedTab(account_t **a)
{ {
GtkWidget * frame; GtkWidget * frame;
GtkWidget * table; GtkWidget * table;
account_t * currentAccount;
// Default settings // Default settings
gchar * curAccountResolveOnce = "FALSE"; gchar * curAccountResolveOnce = "FALSE";
gchar * curAccountExpire = "600"; gchar * curAccountExpire = "600";
account_t * currentAccount = a; currentAccount = *a;
// Load from SIP/IAX/Unknown ? // Load from SIP/IAX/Unknown ?
if(currentAccount) { if(currentAccount) {
...@@ -267,6 +270,7 @@ GtkWidget * createAdvancedTab(account_t * a) ...@@ -267,6 +270,7 @@ GtkWidget * createAdvancedTab(account_t * a)
gtk_widget_show_all( table ); gtk_widget_show_all( table );
gtk_container_set_border_width (GTK_CONTAINER(table), 10); gtk_container_set_border_width (GTK_CONTAINER(table), 10);
*a = currentAccount;
return frame; return frame;
} }
...@@ -277,8 +281,9 @@ show_account_window (account_t * a) ...@@ -277,8 +281,9 @@ show_account_window (account_t * a)
GtkWidget * notebook; GtkWidget * notebook;
GtkWidget * tab; GtkWidget * tab;
gint response; gint response;
account_t *currentAccount;
account_t * currentAccount = a; currentAccount = a;
dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Account settings"), dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Account settings"),
GTK_WINDOW(get_main_window()), GTK_WINDOW(get_main_window()),
...@@ -298,18 +303,19 @@ show_account_window (account_t * a) ...@@ -298,18 +303,19 @@ show_account_window (account_t * a)
gtk_widget_show(notebook); gtk_widget_show(notebook);
/* General Settings */ /* General Settings */
tab = createAccountTab(a); tab = createAccountTab(&currentAccount);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Basic"))); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Basic")));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
/* Advanced */ /* Advanced */
tab = createAdvancedTab(a); tab = createAdvancedTab(&currentAccount);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Advanced"))); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Advanced")));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) , 0); gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) , 0);
response = gtk_dialog_run (GTK_DIALOG (dialog)); response = gtk_dialog_run (GTK_DIALOG (dialog));
if(response == GTK_RESPONSE_ACCEPT) if(response == GTK_RESPONSE_ACCEPT)
{ {
gchar* proto = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(entryProtocol)); gchar* proto = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(entryProtocol));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment