Changeset 3390
- Timestamp:
- 02/09/08 17:11:54
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymailui-gtk/tny-gtk-folder-store-tree-model.c
r3385 r3390 401 401 } AccNotYetReadyInfo; 402 402 403 static void 404 notify_signal_slots (gpointer user_data, GObject *instance) 405 { 406 TnyGtkFolderStoreTreeModel *self = (TnyGtkFolderStoreTreeModel *) user_data; 407 int i=0; 408 409 for (i=0; i < self->signals->len; i++) { 410 SignalSlot *slot = (SignalSlot *) self->signals->pdata[i]; 411 if (slot->instance == instance) 412 slot->instance = NULL; 413 } 414 } 415 403 416 static gboolean 404 417 account_was_not_yet_ready_idle (gpointer user_data) … … 412 425 413 426 slot = g_slice_new (SignalSlot); 414 slot->instance = g_object_ref (info->account);427 slot->instance = (GObject *) info->account; 415 428 slot->handler_id = g_signal_connect (info->account, "connection-status-changed", 416 429 G_CALLBACK (tny_gtk_folder_store_tree_model_on_constatus_changed), info->self); 430 g_object_weak_ref (G_OBJECT (info->account), notify_signal_slots, info->self); 417 431 g_ptr_array_add (info->self->signals, slot); 418 432 419 433 slot = g_slice_new (SignalSlot); 420 slot->instance = g_object_ref (info->account);434 slot->instance = (GObject *) info->account; 421 435 slot->handler_id = g_signal_connect (info->account, "changed", 422 436 G_CALLBACK (tny_gtk_folder_store_tree_model_on_changed), info->self); 437 g_object_weak_ref (G_OBJECT (info->account), notify_signal_slots, info->self); 423 438 g_ptr_array_add (info->self->signals, slot); 424 439 … … 445 460 g_slice_free (AccNotYetReadyInfo, user_data); 446 461 } 462 447 463 448 464 static void … … 484 500 485 501 slot = g_slice_new (SignalSlot); 486 slot->instance = g_object_ref (folder_store); 502 503 slot->instance = (GObject *)folder_store; 487 504 slot->handler_id = g_signal_connect (folder_store, "connection-status-changed", 488 505 G_CALLBACK (tny_gtk_folder_store_tree_model_on_constatus_changed), self); 506 g_object_weak_ref (G_OBJECT (folder_store), notify_signal_slots, self); 489 507 g_ptr_array_add (self->signals, slot); 490 508 491 509 slot = g_slice_new (SignalSlot); 492 slot->instance = g_object_ref (folder_store);510 slot->instance = (GObject *)folder_store; //g_object_ref (folder_store); 493 511 slot->handler_id = g_signal_connect (folder_store, "changed", 494 512 G_CALLBACK (tny_gtk_folder_store_tree_model_on_changed), self); 513 g_object_weak_ref (G_OBJECT (folder_store), notify_signal_slots, self); 495 514 g_ptr_array_add (self->signals, slot); 496 515 } … … 551 570 for (i = 0; i < me->signals->len; i++) { 552 571 SignalSlot *slot = (SignalSlot *) me->signals->pdata [i]; 553 g_signal_handler_disconnect (slot->instance, slot->handler_id); 554 g_object_unref (slot->instance); 572 if (slot->instance) { 573 g_signal_handler_disconnect (slot->instance, slot->handler_id); 574 g_object_weak_unref (G_OBJECT (slot->instance), notify_signal_slots, object); 575 } 555 576 g_slice_free (SignalSlot, slot); 556 577 }
