[colord] python Colord.Device.get_default_profile()
Sanford Rockowitz
rockowitz at minsoft.com
Wed Feb 26 08:16:18 PST 2014
GObject introspection is way outside my area of expertise, I'm afraid.
The only thing to add is that this works:
default_profile = device.get_default_profile()
print default_profile
profiles = device_get_profiles()
print profiles
Regards,
Sanford
On 02/26/2014 01:13 AM, Richard Hughes wrote:
> On 26 February 2014 02:40, Sanford Rockowitz <rockowitz at minsoft.com> wrote:
>> Not sure if I'm misusing/misunderstanding the Python API, or if there's a
>> bug here.
> A bug I think -- this fails:
>
> device = client.find_device_sync(device_id, GIO_CANCELLABLE)
> device.connect_sync(GIO_CANCELLABLE)
> profiles = device.get_profiles()
> default_profile = device.get_default_profile()
>
> ...this works:
>
> device = client.find_device_sync(device_id, GIO_CANCELLABLE)
> device.connect_sync(GIO_CANCELLABLE)
> #profiles = device.get_profiles()
> default_profile = device.get_default_profile()
>
> For the first snippet, breaking on cd_device_get_default_profile()
> shows the device->priv->profiles array being empty. Odder.
>
> profiles = device.get_profiles()
> print profiles
> profiles = device.get_profiles()
> print profiles
>
> gives:
>
> [<Profile object at 0xb65690 (CdProfile at 0xbdab50)>]
> []
>
> So the action of getting the profiles clears the array. The only thing
> that clears that array is cd_device_set_profiles_array_from_variant(),
> which is only called on device connect. valgrind doesn't seem to
> complain about memory accesses, although I don't know if that is
> supposed to work in GObjectIntrospection python.
>
> So, I set up gdb to break on cd_profile_finalize -- this gets fired
> after get_profiles() gets called the second time, before the [] gets
> printed, from pygobject_dealloc. This is what I would have expected to
> see if the introspection was marked (transfer full) -- but the
> Colord-1.0.gir file clearly has <return-value
> transfer-ownership="container">.
>
> Very odd. Any ideas? In the meantime you can do profiles[0] to get the
> default profile, but we need to fix this.
>
> Richard
>
More information about the colord
mailing list