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



commit f98e006e6fa694003d4cba1d76660f9a5afa8597
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 20 14:29:30 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.
    Bug #639575 (Michael Edwards).

 ChangeLog            |    9 +++++++++
 gio/src/resolver.ccg |    4 ++--
 gio/src/resolver.hg  |    5 ++---
 3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7886e3f..396e30d 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).
+
 2010-09-28  Armin Burgmeier  <armin arbur net>
 
 	* MSVC_Net2005/examples/compose/compose.vcproj:
diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg
index e7be91b..db85fb4 100644
--- a/gio/src/resolver.ccg
+++ b/gio/src/resolver.ccg
@@ -40,7 +40,7 @@ Glib::ListHandle< Glib::RefPtr<InetAddress> > Resolver::lookup_by_name(const Gli
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 {
   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);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
@@ -80,7 +80,7 @@ ListHandle_SrvTarget Resolver::lookup_service(const Glib::ustring& service, cons
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 {
   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);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   if(gerror)
     ::Glib::Error::throw_exception(gerror);
diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg
index 245c6df..dcee7f3 100644
--- a/gio/src/resolver.hg
+++ b/gio/src/resolver.hg
@@ -58,7 +58,7 @@ 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)
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname);
@@ -70,7 +70,6 @@ public:
   _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)
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address);
@@ -82,7 +81,7 @@ public:
   _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)
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain);



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