PackageKit: Fix a crash properly
authorJean-Philippe ANDRE <jpeg@videolan.org>
Sat, 18 Apr 2015 08:19:00 +0000 (17:19 +0900)
committerJean-Philippe ANDRE <jpeg@videolan.org>
Sat, 18 Apr 2015 08:19:00 +0000 (17:19 +0900)
This reverts and tries to actually fix:

commit b30892056e0a527545c8a022cd2b3cdef0ec85af
Author: Jean-Philippe Andre <jp.andre@samsung.com>
Date:   Fri Apr 17 10:30:06 2015 +0900

    PackageKit: Fix crash on error

    Sometimes a "normal" error occurs and then the callback is
    called with no context data. Then crash boom sigsegv happens.

src/modules/packagekit/e_mod_packagekit.c

index 051d620..d1b1f1d 100644 (file)
@@ -220,7 +220,6 @@ static void
 _store_error(E_PackageKit_Module_Context *ctxt, const char *err)
 {
    ERR("PKGKIT: ERROR: %s", err);
-   if (!ctxt) return; // see packagekit_get_updates()
    if (ctxt->error)
       eina_stringshare_replace(&ctxt->error, err);
    else
@@ -396,9 +395,9 @@ packagekit_get_updates(E_PackageKit_Module_Context *ctxt, const char *transactio
    obj = eldbus_object_get(ctxt->conn, "org.freedesktop.PackageKit", transaction);
    proxy = eldbus_proxy_get(obj, "org.freedesktop.PackageKit.Transaction");
    if (PKITV07)
-     pending = eldbus_proxy_call(proxy, "GetUpdates", null_cb, NULL, -1, "s", "none");
+     pending = eldbus_proxy_call(proxy, "GetUpdates", null_cb, ctxt, -1, "s", "none");
    else
-     pending = eldbus_proxy_call(proxy, "GetUpdates", null_cb, NULL, -1, "t", 1);
+     pending = eldbus_proxy_call(proxy, "GetUpdates", null_cb, ctxt, -1, "t", 1);
    if (!pending)
      {
         _store_error(ctxt, "could not call GetUpdates()");