[packagekit] Segmentation fault, help needed

Richard Hughes hughsient at gmail.com
Sat Sep 8 02:23:16 PDT 2007


On 08/09/2007, Grzegorz Dąbrowski <gdx at o2.pl> wrote:
> Hi,
>
> I have a problem with the box backend. I'm using thread for searching
> packages. When I called pk_backend_finished (backend,
> PK_EXIT_ENUM_SUCCESS) in the thread, a daemon do a segmentation fault
> because pk_backend_finalize was called before. Can someone explain me
> what is going on and how fix it?

gboolean
pk_backend_finished (PkBackend *backend, PkTaskExit exit)
{
	g_return_val_if_fail (backend != NULL, FALSE);
	g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);

	/* we have to run this idle as the command may finish before the job
	 * has been sent to the client. I love async... */
	pk_debug ("adding finished %p to idle loop", backend);
	backend->priv->exit = exit;
	g_idle_add (pk_backend_finished_idle, backend);
}

I think you are hitting that. We have to make the registration more
robust as you are probably hitting a race inbetween the unref and the
g_idle_add.

Is the finish signal emmitted in the thread really quickly after
running the action? You can test this by adding a sleep in the thread
code for a few ms. If that works then we've got a race and we'll have
to change the registration code path.

Richard.


More information about the PackageKit mailing list