[colord] Python GIR coding problem

Sanford Rockowitz rockowitz at minsoft.com
Wed Jul 3 04:45:09 PDT 2013


On 07/02/2013 12:41 AM, Richard Hughes wrote:
> On 2 July 2013 01:35, Sanford Rockowitz <rockowitz at minsoft.com> wrote:
>> The problem arises  when trying to access  one device in the list returned
>> by client.get_devices_sync(cancellable).   Trying to do dev.connect_sync()
>> on the device in the list causes a seg fault.  If I insert the dir(dev)
>> line, that fails with the slightly more useful error message:
> That looks familiar.
>
>> What am I doing wrong?
> Nothing, it's completely my fault. I've just committed this to master
> and colord-1-0:
> https://github.com/hughsie/colord/commit/e9010f720b8c6a0c2e7bcb6e646a19b473871dcb
> [1]
>
> Basically, as we're returning a GPtrArray we want to just unref the
> container, not the container and everything in it (as the container
> automatically unrefs the contents). If you rebuild your version of
> colord with that patch it will work fine. I don't think you can
> workaround the bug by doing something like: for d in devices: d.ref()
> as I don't think python lets you tweak the refcount like that. On
> Ubuntu you might be able to do dev.ref_count = dev.ref_count + 1,
> although I can't test this here.

Had tried to increment dev_ref_count on Ubuntu, got the message:

RuntimeError: unable to set value for field

>
> Richard.
>
> [1] I can offer a Fedora 18/19 package if this would make testing easier.

If it's easy to do that would let me confirm that the fix works. Trying 
to build from master puts me into versioning hell.  I should be able to 
build from colord-1.0, but something's not right and it will probably be 
a day or two before I have time to figure it out.

Thanks,
Sanford


>



More information about the colord mailing list