[packagekit] packagekit: Branch 'master' - 2 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Oct 16 15:08:33 PDT 2007
libpackagekit/pk-network.c | 15 ++++++++++-----
src/pk-engine.c | 6 ++++++
src/pk-main.c | 3 +++
3 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit 09777218b3f9d76d6fcadd8a977012bc74652f9b
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 16 23:06:47 2007 +0100
make PkNetwork into a singleton. libnm_glib does very bad things when you init, shutdown, init, shutdown repeatedly. This made packagekitd not start when initialising about 1 in 10 times when running with the dummy backend. This took me hours to find.
diff --git a/libpackagekit/pk-network.c b/libpackagekit/pk-network.c
index f0da71d..cb12231 100644
--- a/libpackagekit/pk-network.c
+++ b/libpackagekit/pk-network.c
@@ -60,7 +60,8 @@ enum {
PK_NETWORK_LAST_SIGNAL
};
-static guint signals [PK_NETWORK_LAST_SIGNAL] = { 0, };
+static guint signals [PK_NETWORK_LAST_SIGNAL] = { 0, };
+static gpointer pk_network_object = NULL;
G_DEFINE_TYPE (PkNetwork, pk_network, G_TYPE_OBJECT)
@@ -144,7 +145,7 @@ pk_network_finalize (GObject *object)
g_return_if_fail (network->priv != NULL);
libnm_glib_unregister_callback (network->priv->ctx, network->priv->callbackid);
-// libnm_glib_shutdown (network->priv->ctx);
+ libnm_glib_shutdown (network->priv->ctx);
G_OBJECT_CLASS (pk_network_parent_class)->finalize (object);
}
@@ -157,7 +158,11 @@ pk_network_finalize (GObject *object)
PkNetwork *
pk_network_new (void)
{
- PkNetwork *network;
- network = g_object_new (PK_TYPE_NETWORK, NULL);
- return PK_NETWORK (network);
+ if (pk_network_object != NULL) {
+ g_object_ref (pk_network_object);
+ } else {
+ pk_network_object = g_object_new (PK_TYPE_NETWORK, NULL);
+ g_object_add_weak_pointer (pk_network_object, &pk_network_object);
+ }
+ return PK_NETWORK (pk_network_object);
}
diff --git a/src/pk-engine.c b/src/pk-engine.c
index bf5dc49..3aa2221 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -43,6 +43,7 @@
#include <pk-debug.h>
#include <pk-common.h>
+#include <pk-network.h>
#include <pk-package-list.h>
#include <pk-enum.h>
@@ -70,6 +71,7 @@ struct PkEnginePrivate
PkTransactionItem *sync_item;
PkPackageList *updates_cache;
PkInhibit *inhibit;
+ PkNetwork *network;
PkEnumList *actions;
PkEnumList *groups;
PkEnumList *filters;
@@ -2530,6 +2532,9 @@ pk_engine_init (PkEngine *engine)
/* we save a cache of the latest update lists sowe can do cached responses */
engine->priv->updates_cache = NULL;
+ /* we dont need this, just don't keep creating and destroying it */
+ engine->priv->network = pk_network_new ();
+
engine->priv->transaction_list = pk_transaction_list_new ();
g_signal_connect (engine->priv->transaction_list, "changed",
G_CALLBACK (pk_engine_transaction_list_changed_cb), engine);
@@ -2586,6 +2591,7 @@ pk_engine_finalize (GObject *object)
g_object_unref (engine->priv->actions);
g_object_unref (engine->priv->groups);
g_object_unref (engine->priv->filters);
+ g_object_unref (engine->priv->network);
if (engine->priv->updates_cache != NULL) {
pk_debug ("unreffing updates cache");
commit a0c502e4265142c79ea150b98b0d52bdf74c7579
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 16 21:58:41 2007 +0100
crash on fatal warnings for the development release
diff --git a/src/pk-main.c b/src/pk-main.c
index e34459d..9804d68 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -181,6 +181,9 @@ main (int argc, char *argv[])
goto unref_program;
}
+ /* force to crash for development releases */
+ setenv ("G_DEBUG", "fatal_criticals", 1);
+
if (!g_thread_supported ())
g_thread_init (NULL);
dbus_g_thread_init ();
More information about the PackageKit
mailing list