Changeset 3585
- Timestamp:
- 04/15/08 10:30:20
- Files:
-
- trunk/libtinymail-maemo/tny-maemo-conic-device.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-maemo/tny-maemo-conic-device.c
r3581 r3585 112 112 g_debug ("%s: destroying status info (%p)", __FUNCTION__, user_data); 113 113 114 if (G_IS_OBJECT(info->self)) 114 if (G_IS_OBJECT(info->self)) { 115 115 g_object_unref (info->self); 116 117 g_slice_free (EmitStatusInfo, info);118 119 g_debug ("%s: destroyed %p", __FUNCTION__, user_data);116 g_slice_free (EmitStatusInfo, info); 117 g_debug ("%s: destroyed %p", __FUNCTION__, user_data); 118 } else 119 g_warning ("%s: BUG: not a valid info", __FUNCTION__); 120 120 } 121 121 … … 210 210 g_error_free (err); 211 211 212 g_object_unref (info->self); 213 g_free (info->iap_id); 214 g_slice_free (ConnectInfo, info); 212 if (G_IS_OBJECT(info->self)) { 213 g_object_unref (info->self); 214 g_free (info->iap_id); 215 info->iap_id = NULL; 216 g_slice_free (ConnectInfo, info); 217 } else 218 g_warning ("%s: BUG: info seems b0rked", __FUNCTION__); 215 219 } 216 220 } … … 244 248 info = (HandleConnInfo *) data; 245 249 246 if (G_IS_OBJECT(info->self)) 250 if (G_IS_OBJECT(info->self)) { 247 251 g_object_unref (info->self); 248 249 g_slice_free (HandleConnInfo, data); 252 g_slice_free (HandleConnInfo, data); 253 } else 254 g_warning ("%s: BUG: data seems b0rked", __FUNCTION__); 250 255 } 251 256 … … 332 337 } 333 338 334 if (emit) 339 if (emit) { 340 g_debug ("%s: emiting is_online (%s)", 341 __FUNCTION__, is_online ? "true" : "false"); 335 342 conic_emit_status (TNY_DEVICE (device), is_online); 343 } 336 344 } 337 345 338 346 339 347 /** 340 * tny_maemo_conic_device_connect :348 * tny_maemo_conic_device_connect_async: 341 349 * @self: a #TnyDevice object 342 350 * @iap_id: the id of the Internet Access Point (IAP), or NULL for 'any; … … 397 405 if (request_failed) { 398 406 priv->connect_slot = NULL; 399 if (info->callback) 400 info->callback (info->self, iap_id, FALSE, err, info->user_data); 401 g_free (info->iap_id); 402 g_object_unref (info->self); 403 g_slice_free (ConnectInfo, info); 407 if (G_IS_OBJECT(info->self)) { 408 if (info->callback) 409 info->callback (info->self, iap_id, FALSE, err, info->user_data); 410 g_free (info->iap_id); 411 info->iap_id = NULL; 412 g_object_unref (info->self); 413 info->self = NULL; 414 g_slice_free (ConnectInfo, info); 415 } else 416 g_warning ("%s: BUG: info seems b0rked", __FUNCTION__); 404 417 } 405 418 } … … 521 534 } 522 535 536 static void 537 unref_gobject (GObject *obj) 538 { 539 if (G_IS_OBJECT(obj)) 540 g_object_unref(obj); 541 else 542 g_warning ("%s: not a valid GObject (%p)", 543 __FUNCTION__, obj); 544 } 545 523 546 524 547 /** … … 532 555 tny_maemo_conic_device_free_iap_list (TnyMaemoConicDevice *self, GSList* cnx_list) 533 556 { 534 g_slist_foreach (cnx_list, (GFunc) g_object_unref, NULL);557 g_slist_foreach (cnx_list, (GFunc)unref_gobject, NULL); 535 558 g_slist_free (cnx_list); 536 559 } … … 555 578 556 579 /* Signal if it changed: */ 557 if (!already_online) 580 if (!already_online) { 581 g_debug ("%s: emiting connection-changed signal", 582 __FUNCTION__); 558 583 g_signal_emit (device, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], 0, TRUE); 584 } 559 585 } 560 586 … … 598 624 /* We should not have a real is_online, based on what libconic has told us: */ 599 625 600 priv->forced = FALSE;601 priv->iap = NULL;602 priv->is_online = FALSE;626 priv->forced = FALSE; 627 priv->iap = NULL; 628 priv->is_online = FALSE; 603 629 priv->connect_slot = NULL; 604 630 … … 621 647 /* This will get us in connected state only if there is already a connection. 622 648 * thus, this will setup our state correctly when we receive the signals. */ 623 if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_AUTOMATICALLY_TRIGGERED)) 649 if (!con_ic_connection_connect (priv->cnx, 650 CON_IC_CONNECT_FLAG_AUTOMATICALLY_TRIGGERED)) 624 651 g_warning ("%s: could not send connect dbus message", 625 652 __FUNCTION__); … … 643 670 TnyMaemoConicDevicePriv *priv; 644 671 645 g_return_if_fail ( obj && G_IS_OBJECT(obj));646 647 g_debug ("%s ", __FUNCTION__);672 g_return_if_fail (TNY_IS_MAEMO_CONIC_DEVICE(obj)); 673 674 g_debug ("%s: shutting the device down...", __FUNCTION__); 648 675 649 676 priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (obj); … … 657 684 g_object_unref (priv->cnx); 658 685 priv->cnx = NULL; 659 } 660 661 if (priv->iap) {662 g_free (priv->iap);663 priv->iap = NULL;664 }686 } else 687 g_warning ("%s: BUG: priv->cnx is not a valid connection", 688 __FUNCTION__); 689 690 g_free (priv->iap); 691 priv->iap = NULL; 665 692 666 693 (*parent_class->finalize) (obj); … … 763 790 ConIcConnectFlags flags; 764 791 792 g_warning ("%s: you should tny_maemo_conic_device_connect_async", 793 __FUNCTION__); 794 765 795 g_return_val_if_fail (TNY_IS_DEVICE(self), FALSE); 766 796 priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); … … 788 818 789 819 if (request_failed) { 790 g_ object_unref (priv->loop);820 g_main_loop_unref (priv->loop); 791 821 priv->loop = NULL; 792 822 } … … 802 832 GDK_THREADS_ENTER(); 803 833 804 g_main_loop_unref (priv->loop); 805 priv->loop = NULL; 834 if (priv->loop) { 835 g_main_loop_unref (priv->loop); 836 priv->loop = NULL; 837 } 806 838 807 839 return priv->is_online;
