[glibmm/glibmm-2-26] Resolver: lookup_service(), lookup_by_address(): Fix the reference counting.



commit 5e0eaab693ef70351a4a173643ba4ad2e9414296
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 20 14:20:44 2011 +0100

    Resolver: lookup_service(), lookup_by_address(): Fix the reference counting.
    
    * gio/src/resolver.[hg|ccg]: Use the correct OWNERSHIP_*, based on the
    documentation for the C functions. We must release both the list and the
    items.

 ChangeLog            |    9 +++++++++
 gio/src/resolver.ccg |    4 ++--
 gio/src/resolver.hg  |   24 +++++++++++++++++++++---
 3 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ae75fb5..b5b5e1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-20  Murray Cumming  <murrayc murrayc com>
+
+	Resolver: lookup_service(), lookup_by_address(): Fix the reference counting.
+
+	* gio/src/resolver.[hg|ccg]: Use the correct OWNERSHIP_*, based on the 
+	documentation for the C functions. We must release both the list and the 
+	items.
+	Bug #639575 (Michael Edwards).
+
 2011-01-05  Murray Cumming  <murrayc murrayc com>
 
 	BufferedInputStream, BufferedOutputStream: Correct property name.
diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg
index 4134c59..fb63c06 100644
--- a/gio/src/resolver.ccg
+++ b/gio/src/resolver.ccg
@@ -36,7 +36,7 @@ void Resolver::set_default(const Glib::RefPtr<Resolver>& resolver)
 Glib::ListHandle< Glib::RefPtr<InetAddress> > Resolver::lookup_by_name(const Glib::ustring& hostname)
 {
   GError* gerror = 0;
-  Glib::ListHandle< Glib::RefPtr<InetAddress> > retvalue = Glib::ListHandle< Glib::RefPtr<InetAddress> >(g_resolver_lookup_by_name(gobj(), hostname.c_str(), 0, &(gerror)), Glib::OWNERSHIP_SHALLOW);
+  Glib::ListHandle< Glib::RefPtr<InetAddress> > retvalue = Glib::ListHandle< Glib::RefPtr<InetAddress> >(g_resolver_lookup_by_name(gobj(), hostname.c_str(), 0, &(gerror)), Glib::OWNERSHIP_DEEP);
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
 
@@ -58,7 +58,7 @@ Glib::ustring Resolver::lookup_by_address(const Glib::RefPtr<InetAddress>& addre
 ListHandle_SrvTarget Resolver::lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain)
 {
   GError* gerror = 0;
-  ListHandle_SrvTarget retvalue = ListHandle_SrvTarget(g_resolver_lookup_service(gobj(), service.c_str(), protocol.c_str(), domain.c_str(), 0, &(gerror)), Glib::OWNERSHIP_SHALLOW);
+  ListHandle_SrvTarget retvalue = ListHandle_SrvTarget(g_resolver_lookup_service(gobj(), service.c_str(), protocol.c_str(), domain.c_str(), 0, &(gerror)), Glib::OWNERSHIP_DEEP);
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
 
diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg
index f3ffe43..589c7a2 100644
--- a/gio/src/resolver.hg
+++ b/gio/src/resolver.hg
@@ -58,28 +58,46 @@ public:
   // g_resolver_free_addresses is just a C convenience function
   _IGNORE(g_resolver_free_addresses)
 
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
+#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_name, errthrow)
+  
+  //TODO: Documentation
   Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname);
+  
+  //TODO: Documentation
   void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+  
+  //TODO: Documentation
   void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot);
   _IGNORE(g_resolver_lookup_by_name_async)
+  
   _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_name_finish, errthrow)
 
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
   _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_address, errthrow)
+  
+  //TODO: Documentation
   Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address);
   void lookup_by_address_async(const Glib::RefPtr<InetAddress>& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+  
+  //TODO: Documentation
   void lookup_by_address_async(const Glib::RefPtr<InetAddress>& address, const SlotAsyncReady& slot);
   _IGNORE(g_resolver_lookup_by_address_async)
+  
   _WRAP_METHOD(Glib::ustring lookup_by_address_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_address_finish, errthrow)
 
-#m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_SHALLOW)')
+#m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_service, errthrow)
+
+  //TODO: Documentation
   ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain);
+  
+  //TODO: Documentation
   void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+  
+  //TODO: Documentation
   void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot);
   _IGNORE(g_resolver_lookup_service_async)
+
   _WRAP_METHOD(ListHandle_SrvTarget lookup_service_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_service_finish, errthrow)
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]