Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 4892:dc6de8ad81ae
[gaim-migrate @ 5222]
memleak fixes in all kinds of places. mainly in smiley themes.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 25 Mar 2003 06:37:45 +0000 |
parents | 677d3cb193a1 |
children | 9e50494f63a1 |
comparison
equal
deleted
inserted
replaced
4891:cfa045006bec | 4892:dc6de8ad81ae |
---|---|
147 URL_CLICKED, | 147 URL_CLICKED, |
148 LAST_SIGNAL | 148 LAST_SIGNAL |
149 }; | 149 }; |
150 static guint signals [LAST_SIGNAL] = { 0 }; | 150 static guint signals [LAST_SIGNAL] = { 0 }; |
151 | 151 |
152 static gboolean | |
153 gtk_smiley_tree_destroy_from_hash(gpointer key, gpointer value, | |
154 gpointer user_data) | |
155 { | |
156 gtk_smiley_tree_destroy(value); | |
157 return TRUE; | |
158 } | |
159 | |
160 static void | 152 static void |
161 gtk_imhtml_finalize (GObject *object) | 153 gtk_imhtml_finalize (GObject *object) |
162 { | 154 { |
163 GtkIMHtml *imhtml = GTK_IMHTML(object); | 155 GtkIMHtml *imhtml = GTK_IMHTML(object); |
164 g_hash_table_foreach_remove(imhtml->smiley_data, gtk_smiley_tree_destroy_from_hash, NULL); | |
165 g_hash_table_destroy(imhtml->smiley_data); | 156 g_hash_table_destroy(imhtml->smiley_data); |
166 gtk_smiley_tree_destroy(imhtml->default_smilies); | 157 gtk_smiley_tree_destroy(imhtml->default_smilies); |
167 gdk_cursor_unref(imhtml->hand_cursor); | 158 gdk_cursor_unref(imhtml->hand_cursor); |
168 gdk_cursor_unref(imhtml->arrow_cursor); | 159 gdk_cursor_unref(imhtml->arrow_cursor); |
169 if(imhtml->tip_window){ | 160 if(imhtml->tip_window){ |
223 imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); | 214 imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); |
224 | 215 |
225 imhtml->show_smileys = TRUE; | 216 imhtml->show_smileys = TRUE; |
226 imhtml->show_comments = TRUE; | 217 imhtml->show_comments = TRUE; |
227 | 218 |
228 imhtml->smiley_data = g_hash_table_new (g_str_hash, g_str_equal); | 219 imhtml->smiley_data = g_hash_table_new_full(g_str_hash, g_str_equal, |
220 g_free, gtk_smiley_tree_destroy); | |
229 imhtml->default_smilies = gtk_smiley_tree_new(); | 221 imhtml->default_smilies = gtk_smiley_tree_new(); |
230 | 222 |
231 g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL); | 223 g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL); |
232 | 224 |
233 imhtml->tip = NULL; | 225 imhtml->tip = NULL; |
460 if (sml == NULL) | 452 if (sml == NULL) |
461 tree = imhtml->default_smilies; | 453 tree = imhtml->default_smilies; |
462 else if ((tree = g_hash_table_lookup(imhtml->smiley_data, sml))) { | 454 else if ((tree = g_hash_table_lookup(imhtml->smiley_data, sml))) { |
463 } else { | 455 } else { |
464 tree = gtk_smiley_tree_new(); | 456 tree = gtk_smiley_tree_new(); |
465 g_hash_table_insert(imhtml->smiley_data, sml, tree); | 457 g_hash_table_insert(imhtml->smiley_data, g_strdup(sml), tree); |
466 } | 458 } |
467 | 459 |
468 gtk_smiley_tree_insert (tree, smiley); | 460 gtk_smiley_tree_insert (tree, smiley); |
469 } | 461 } |
470 | 462 |
1185 0, TRUE, 0.0, 1.0); | 1177 0, TRUE, 0.0, 1.0); |
1186 gtk_text_buffer_delete_mark (imhtml->text_buffer, mark); | 1178 gtk_text_buffer_delete_mark (imhtml->text_buffer, mark); |
1187 return str; | 1179 return str; |
1188 } | 1180 } |
1189 | 1181 |
1190 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml) | 1182 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml) |
1191 { | 1183 { |
1192 g_hash_table_destroy(imhtml->smiley_data); | 1184 g_hash_table_destroy(imhtml->smiley_data); |
1193 gtk_smiley_tree_destroy(imhtml->default_smilies); | 1185 gtk_smiley_tree_destroy(imhtml->default_smilies); |
1194 imhtml->smiley_data = g_hash_table_new (g_str_hash, g_str_equal); | 1186 imhtml->smiley_data = g_hash_table_new_full(g_str_hash, g_str_equal, |
1187 g_free, gtk_smiley_tree_destroy); | |
1195 imhtml->default_smilies = gtk_smiley_tree_new(); | 1188 imhtml->default_smilies = gtk_smiley_tree_new(); |
1196 } | 1189 } |
1197 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, | 1190 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, |
1198 gboolean show) | 1191 gboolean show) |
1199 { | 1192 { |