Changeset 1913
- Timestamp:
- 05/08/07 13:22:08
- Files:
-
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (6 diffs)
- trunk/libtinymailui-gtk/tny-gtk-header-list-model.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-camel/tny-camel-folder.c
r1907 r1913 80 80 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 81 81 TnyIterator *iter; 82 TnyList *list; 82 83 83 84 if (!priv->sobservers) … … 85 86 86 87 g_static_rec_mutex_lock (priv->obs_lock); 87 88 iter = tny_list_create_iterator (priv->sobservers); 88 list = tny_list_copy (priv->sobservers); 89 g_static_rec_mutex_unlock (priv->obs_lock); 90 91 iter = tny_list_create_iterator (list); 92 89 93 while (!tny_iterator_is_done (iter)) 90 94 { … … 96 100 g_object_unref (G_OBJECT (iter)); 97 101 98 g_ static_rec_mutex_unlock (priv->obs_lock);102 g_object_unref (list); 99 103 100 104 } … … 105 109 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 106 110 TnyIterator *iter; 111 TnyList *list; 107 112 108 113 if (!priv->observers) … … 110 115 111 116 g_static_rec_mutex_lock (priv->obs_lock); 112 113 iter = tny_list_create_iterator (priv->observers); 117 list = tny_list_copy (priv->observers); 118 g_static_rec_mutex_unlock (priv->obs_lock); 119 120 iter = tny_list_create_iterator (list); 121 114 122 while (!tny_iterator_is_done (iter)) 115 123 { … … 121 129 g_object_unref (G_OBJECT (iter)); 122 130 123 g_ static_rec_mutex_unlock (priv->obs_lock);131 g_object_unref (list); 124 132 125 133 } trunk/libtinymailui-gtk/tny-gtk-header-list-model.c
r1910 r1913 94 94 g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE); 95 95 96 g_static_rec_mutex_lock (list_model->iterator_lock); 96 g_static_rec_mutex_lock (list_model->iterator_lock); 97 97 98 98 i = gtk_tree_path_get_indices (path)[0]; … … 239 239 gint i; 240 240 241 if (iter->stamp != TNY_GTK_HEADER_LIST_MODEL (self)->stamp)241 if (iter->stamp != list_model->stamp) 242 242 return; 243 243 … … 572 572 TnyGtkHeaderListModel *self; 573 573 GObject *item; 574 GMainLoop *loop; 574 575 } notify_views_data_t; 575 576 … … 579 580 { 580 581 notify_views_data_t *stuff = data; 582 581 583 g_object_unref (stuff->item); 582 584 g_object_unref (stuff->self); 585 586 g_main_loop_unref (stuff->loop); 587 583 588 g_slice_free (notify_views_data_t, data); 584 589 return; … … 590 595 { 591 596 notify_views_data_t *stuff = data; 592 GObject *item = stuff->item;593 597 TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) stuff->self; 594 598 GtkTreePath *path; 595 599 GtkTreeIter iter; 596 gint i; 597 gboolean found = FALSE; 600 gint i; gboolean found = FALSE; 601 GObject *mitem, *item = stuff->item; 602 603 g_static_rec_mutex_lock (me->iterator_lock); 598 604 599 605 for (i=0; i < me->items->len; i++) … … 610 616 path = gtk_tree_path_new (); 611 617 gtk_tree_path_append_index (path, i); 612 if (G_LIKELY (path))613 {614 gtk_tree_model_row_deleted (GTK_TREE_MODEL (me), path);615 g_mutex_lock (me->ra_lock);616 me->cur_len--;617 me->registered--;618 g_mutex_unlock (me->ra_lock); 619 gtk_tree_path_free (path);620 }621 622 g_static_rec_mutex_lock (me->iterator_lock);623 item = g_ptr_array_remove_index (me->items, i); 624 g_static_rec_mutex_unlock (me->iterator_lock);625 if (G_LIKELY (item)) 626 g_object_unref (item);627 }618 gtk_tree_model_row_deleted (GTK_TREE_MODEL (me), path); 619 g_mutex_lock (me->ra_lock); 620 me->cur_len--; 621 me->registered--; 622 g_mutex_unlock (me->ra_lock); 623 gtk_tree_path_free (path); 624 625 mitem = g_ptr_array_remove_index (me->items, i); 626 if (mitem) 627 g_object_unref (mitem); 628 } 629 630 g_static_rec_mutex_unlock (me->iterator_lock); 631 632 if (g_main_loop_is_running (stuff->loop)) 633 g_main_loop_quit (stuff->loop); 628 634 629 635 return FALSE; 630 636 } 631 637 638 632 639 static void 633 640 tny_gtk_header_list_model_remove (TnyList *self, GObject* item) 634 641 { 642 TnyGtkHeaderListModel *me = (TnyGtkHeaderListModel*) self; 635 643 notify_views_data_t *stuff; 644 636 645 stuff = g_slice_new (notify_views_data_t); 637 stuff->self = g_object_ref ( G_OBJECT (self));646 stuff->self = g_object_ref (self); 638 647 stuff->item = g_object_ref (item); 639 g_timeout_add_full (0, G_PRIORITY_DEFAULT_IDLE, 648 649 stuff->loop = g_main_loop_new (NULL, FALSE); 650 651 g_timeout_add_full (0, G_PRIORITY_HIGH_IDLE, 640 652 notify_views_delete, stuff, notify_views_delete_destroy); 653 654 /* This truly sucks :-( */ 655 g_main_loop_run (stuff->loop); 656 641 657 return; 642 658 }
