Now it increase reference of libdbus_connection not eldbus_connection, some
callback are removing the last reference of eldbus_connection.


On Wed, Jul 3, 2013 at 10:57 PM, Carsten Haitzler <ras...@rasterman.com>wrote:

> On Wed, 3 Jul 2013 22:33:18 -0300 Jose Souza <zehortig...@profusion.mobi>
> said:
>
> > On Wed, Jul 3, 2013 at 8:42 PM, Carsten Haitzler - Enlightenment Git <
> > no-re...@enlightenment.org> wrote:
> >
> > > raster pushed a commit to branch master.
> > >
> > > commit bdd57af1136dd6c81244c15b0456ec06d10fa59e
> > > Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
> > > Date:   Thu Jul 4 08:41:45 2013 +0900
> > >
> > >     eldbus - only unref client conns that are not null after dispatch
> > > ---
> > >  src/lib/eldbus/eldbus_core.c          | 3 ++-
> > >  src/lib/ethumb_client/ethumb_client.c | 2 +-
> > >  2 files changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/lib/eldbus/eldbus_core.c
> b/src/lib/eldbus/eldbus_core.c
> > > index 040fe4c..a92d1e2 100644
> > > --- a/src/lib/eldbus/eldbus_core.c
> > > +++ b/src/lib/eldbus/eldbus_core.c
> > > @@ -772,7 +772,8 @@ eldbus_idler(void *data)
> > >     dbus_connection_ref(conn->dbus_conn);
> > >     DBG("Connection@%p: Dispatching", conn);
> > >     dbus_connection_dispatch(conn->dbus_conn);
> > > -   dbus_connection_unref(conn->dbus_conn);
> > > +   // add the if check as dispact may set conn->dbus_conn to NULL in
> a cb
> > > +   if (conn->dbus_conn) dbus_connection_unref(conn->dbus_conn);
> > >
> > Huuum I think should be better increase eldbus_connection reference
> before
> > call dbus_connection_dispatch().
> > conn->dbus_conn only will be null if some cb remove the last reference of
> > eldbus_connection, so this will ran invalid memory.
> >
> > I will fix this tomorrow at work.
>
> it already does do the _ref() before dispatch. the problem is that
> dbus_conn is
> NULL... some callback dispatch() calls sets it to NULL. actually i have a
> better solution to this... copy it locally.
>
> > >     return ECORE_CALLBACK_RENEW;
> > >  }
> > >
> > > diff --git a/src/lib/ethumb_client/ethumb_client.c
> > > b/src/lib/ethumb_client/ethumb_client.c
> > > index cbd3c96..3d62fa1 100644
> > > --- a/src/lib/ethumb_client/ethumb_client.c
> > > +++ b/src/lib/ethumb_client/ethumb_client.c
> > > @@ -238,7 +238,7 @@ end_connection:
> > >     obj = eldbus_proxy_object_get(client->proxy);
> > >     eldbus_proxy_unref(client->proxy);
> > >     eldbus_object_unref(obj);
> > > -   eldbus_connection_unref(client->conn);
> > > +   if (client->conn) eldbus_connection_unref(client->conn);
> > >
> > >     if (client->connect.free_data)
> > >       client->connect.free_data(client->connect.data);
> > >
> > > --
> > >
> > >
> > >
> ------------------------------------------------------------------------------
> > > This SF.net email is sponsored by Windows:
> > >
> > > Build for Windows Store.
> > >
> > > http://p.sf.net/sfu/windows-dev2dev
> > >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Windows:
> >
> > Build for Windows Store.
> >
> > http://p.sf.net/sfu/windows-dev2dev
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
>
> --
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler)    ras...@rasterman.com
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to