[packagekit] pk-glib2 problem

Richard Hughes hughsient at gmail.com
Tue Sep 15 00:59:03 PDT 2009


2009/9/14 Daniel Nicoletti <dantti85-pk at yahoo.com.br>:
> in resolve I need to know if there is a package version
> provided:
> if (pk_package_id_split(pi)[PK_PACKAGE_ID_VERSION] == NULL) {

You need to either use:

if (pk_package_id_split(pi) != NULL)
or
if (pk_package_id_check(pi) == TRUE)

> This segfaults...
> also as there is not package_id_free
> is this ok?
>
> gchar *pi;
> pi = package_ids[i];
> delete pi;

No, delete is a C++ thing, and the memory is allocated using C. You
need to use g_strfreev() on arrays you've created yourself.

Richard.


More information about the PackageKit mailing list