comparison src/dialogs.c @ 5924:c304abc3e68b

[gaim-migrate @ 6364] This should fix the bug where Set User Info would sometimes crash. It attempted to access a field in account, which on the old system was a static buffer, and would always have some kind of value, but in the new one, it could be NULL. Kaboom! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 20 Jun 2003 03:32:42 +0000
parents 390d32a6b130
children 6690934e5ea6
comparison
equal deleted inserted replaced
5923:1afd1ffd329a 5924:c304abc3e68b
2190 GtkWidget *vbox; 2190 GtkWidget *vbox;
2191 GtkTextBuffer *buffer; 2191 GtkTextBuffer *buffer;
2192 GtkWidget *frame; 2192 GtkWidget *frame;
2193 gchar *buf; 2193 gchar *buf;
2194 GaimAccount *account; 2194 GaimAccount *account;
2195 const char *user_info;
2195 2196
2196 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); 2197 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1);
2197 account = gc->account; 2198 account = gc->account;
2198 b->account = account; 2199 b->account = account;
2199 2200
2220 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); 2221 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
2221 2222
2222 b->text = gtk_text_view_new(); 2223 b->text = gtk_text_view_new();
2223 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR); 2224 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR);
2224 gtk_widget_set_size_request(b->text, 300, 200); 2225 gtk_widget_set_size_request(b->text, 300, 200);
2225 buf = g_malloc(strlen(account->user_info) + 1); 2226
2226 strncpy_nohtml(buf, account->user_info, strlen(account->user_info) + 1); 2227 if ((user_info = gaim_account_get_user_info(account)) != NULL) {
2227 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text)); 2228 buf = g_malloc(strlen(user_info) + 1);
2228 gtk_text_buffer_set_text(buffer, buf, -1); 2229 strncpy_nohtml(buf, user_info, strlen(user_info) + 1);
2229 g_free(buf); 2230 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text));
2231 gtk_text_buffer_set_text(buffer, buf, -1);
2232 g_free(buf);
2233 }
2234
2230 gtk_container_add(GTK_CONTAINER(frame), b->text); 2235 gtk_container_add(GTK_CONTAINER(frame), b->text);
2231 gtk_window_set_focus(GTK_WINDOW(b->window), b->text); 2236 gtk_window_set_focus(GTK_WINDOW(b->window), b->text);
2232 2237
2233 buttons = gtk_hbox_new(FALSE, 5); 2238 buttons = gtk_hbox_new(FALSE, 5);
2234 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0); 2239 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0);