rpms/PackageKit/devel pk-idle-add-pkcontrol-refresh.patch, NONE, 1.1 PackageKit.spec, 1.67, 1.68

Richard Hughes rhughes at fedoraproject.org
Thu Oct 9 16:00:23 UTC 2008


Author: rhughes

Update of /cvs/pkgs/rpms/PackageKit/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32754

Modified Files:
	PackageKit.spec 
Added Files:
	pk-idle-add-pkcontrol-refresh.patch 
Log Message:
* Thu Oct 09 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.6-3
- Add a patch from upstream to fix rh#466290
 
* Mon Oct 06 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.6-2
- Upload new sources. Ooops.
 
* Mon Oct 06 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.6-1
- New upstream version
- Renice the spawned process so that we don't hog the system when doing updates
 
* Wed Oct 01 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.5-4
- Rename the subpackages before David blows a blood vessel.
- yum-packagekit  -> PackageKit-yum-plugin
- udev-packagekit -> PackageKit-udev-helper


pk-idle-add-pkcontrol-refresh.patch:

--- NEW FILE pk-idle-add-pkcontrol-refresh.patch ---
commit 34fc97830dd9ced41b9f8873ea5c357de25e3c46
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Oct 9 16:44:24 2008 +0100

    bugfix: don't crash the client tools if PkControl launches the daemon
    
    If the daemon is launched with PkControl, rather than PkClient, then we attempt to refresh the transaction
    list when the PkControl object is not finished initialising, and we send a critical warning.
    The fix is to only do the refresh in an idle handler, making sure we kill it if nothing ever runs on
    the object

diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index e22082d..03769e8 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -66,6 +66,7 @@ struct _PkControlPrivate
 	DBusGConnection		*connection;
 	PkConnection		*pconnection;
 	gchar			**array;
+	guint			 idle_id;
 };
 
 enum {
@@ -653,6 +654,26 @@ pk_control_transaction_list_refresh (PkControl *control, GError **error)
 }
 
 /**
+ * pk_control_transaction_list_refresh_idle_cb:
+ * @control: This class instance
+ **/
+static gboolean
+pk_control_transaction_list_refresh_idle_cb (PkControl *control)
+{
+	gboolean ret;
+	GError *error = NULL;
+
+	/* refresh the internal lists */
+	ret = pk_control_transaction_list_refresh (control, &error);
+	if (!ret) {
+		egg_warning ("failed to get list: %s", error->message);
+		g_error_free (error);
+	}
+	control->priv->idle_id = 0;
+	return FALSE;
+}
+
+/**
  * pk_control_transaction_list_get:
  **/
 const gchar **
@@ -685,8 +706,8 @@ static void
 pk_control_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkControl *control)
 {
 	/* force a refresh so we have valid data*/
-	if (connected)
-		pk_control_transaction_list_refresh (control, NULL);
+	if (connected && control->priv->idle_id == 0)
+		control->priv->idle_id = g_idle_add ((GSourceFunc) pk_control_transaction_list_refresh_idle_cb, control);
 }
 
 /**
@@ -851,7 +872,6 @@ pk_control_class_init (PkControlClass *klass)
 static void
 pk_control_init (PkControl *control)
 {
-	gboolean ret;
 	GError *error = NULL;
 
 	control->priv = PK_CONTROL_GET_PRIVATE (control);
@@ -865,6 +885,7 @@ pk_control_init (PkControl *control)
 
 	/* we maintain a local copy */
 	control->priv->array = NULL;
+	control->priv->idle_id = 0;
 
 	/* watch for PackageKit on the bus, and try to connect up at start */
 	control->priv->pconnection = pk_connection_new ();
@@ -908,12 +929,8 @@ pk_control_init (PkControl *control)
 	dbus_g_proxy_connect_signal (control->priv->proxy, "Locked",
 				     G_CALLBACK (pk_control_locked_cb), control, NULL);
 
-	/* force a refresh so we have valid data*/
-	ret = pk_control_transaction_list_refresh (control, &error);
-	if (!ret) {
-		egg_warning ("failed to get list: %s", error->message);
-		g_error_free (error);
-	}
+	/* idle add a refresh so we have valid data */
+	control->priv->idle_id = g_idle_add ((GSourceFunc) pk_control_transaction_list_refresh_idle_cb, control);
 }
 
 /**
@@ -944,7 +961,8 @@ pk_control_finalize (GObject *object)
 	dbus_g_proxy_disconnect_signal (control->priv->proxy, "RestartSchedule",
 				        G_CALLBACK (pk_control_restart_schedule_cb), control);
 
-	/* free the proxy */
+	if (control->priv->idle_id != 0)
+		g_source_remove (control->priv->idle_id);
 	g_object_unref (G_OBJECT (control->priv->proxy));
 	g_strfreev (control->priv->array);
 


Index: PackageKit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/PackageKit/devel/PackageKit.spec,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- PackageKit.spec	6 Oct 2008 10:36:43 -0000	1.67
+++ PackageKit.spec	9 Oct 2008 15:59:53 -0000	1.68
@@ -8,15 +8,15 @@
 Summary:   System daemon that is a DBUS abstraction layer for package management
 Name:      PackageKit
 Version:   0.3.6
-Release:   2%{?dist}
+Release:   3%{?dist}
 License:   GPLv2+
 Group:     System Environment/Libraries
 URL:       http://packagekit.freedesktop.org
 Source0:   http://www.packagekit.org/releases/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-# upstream: 920574b72805a630ea989b32012e2b4bbf1841ea
-#Patch0:    pk-fix-64bit-codecs.patch
+# upstream: 34fc97830dd9ced41b9f8873ea5c357de25e3c46
+Patch0:    pk-idle-add-pkcontrol-refresh.patch
 
 Requires: dbus >= %{dbus_version}
 Requires: dbus-glib >= %{dbus_glib_version}
@@ -158,7 +158,7 @@
 
 %prep
 %setup -q
-#%patch0 -p1
+%patch0 -p1
 
 %build
 %configure --enable-yum --enable-smart --with-default-backend=yum --disable-local
@@ -299,6 +299,9 @@
 %{_includedir}/*
 
 %changelog
+* Thu Oct 09 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.6-3
+- Add a patch from upstream to fix rh#466290
+ 
 * Mon Oct 06 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.6-2
 - Upload new sources. Ooops.
  




More information about the scm-commits mailing list