mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 01:09:54 +02:00
2008-05-13 Tambet Ingo <tambet@gmail.com>
* system-settings/src/nm-polkit-helpers.c (create_polkit_context): Use a single PolKitContext which is shared by all. PolKitContext::unref leaks just about everything, including all open file descriptiors and results in 99% cpu usage when data arrives to any of the fds that don't belong to any context anymore. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3662 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
20dddc2c2b
commit
b8df4e8217
2 changed files with 20 additions and 8 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
2008-05-13 Tambet Ingo <tambet@gmail.com>
|
||||||
|
|
||||||
|
* system-settings/src/nm-polkit-helpers.c (create_polkit_context): Use a
|
||||||
|
single PolKitContext which is shared by all. PolKitContext::unref leaks
|
||||||
|
just about everything, including all open file descriptiors and results
|
||||||
|
in 99% cpu usage when data arrives to any of the fds that don't belong
|
||||||
|
to any context anymore.
|
||||||
|
|
||||||
2008-05-12 Dan Williams <dcbw@redhat.com>
|
2008-05-12 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* gfilemonitor/glocaldirectorymonitor.c
|
* gfilemonitor/glocaldirectorymonitor.c
|
||||||
|
|
|
||||||
|
|
@ -76,20 +76,24 @@ pk_io_remove_watch (PolKitContext *pk_context, int watch_id)
|
||||||
PolKitContext *
|
PolKitContext *
|
||||||
create_polkit_context (void)
|
create_polkit_context (void)
|
||||||
{
|
{
|
||||||
PolKitContext *pol_ctx;
|
static PolKitContext *global_context = NULL;
|
||||||
PolKitError *err = NULL;
|
PolKitError *err;
|
||||||
|
|
||||||
pol_ctx = polkit_context_new ();
|
if (G_LIKELY (global_context))
|
||||||
polkit_context_set_io_watch_functions (pol_ctx, pk_io_add_watch, pk_io_remove_watch);
|
return polkit_context_ref (global_context);
|
||||||
if (!polkit_context_init (pol_ctx, &err)) {
|
|
||||||
|
global_context = polkit_context_new ();
|
||||||
|
polkit_context_set_io_watch_functions (global_context, pk_io_add_watch, pk_io_remove_watch);
|
||||||
|
err = NULL;
|
||||||
|
if (!polkit_context_init (global_context, &err)) {
|
||||||
g_warning ("Cannot initialize libpolkit: %s", polkit_error_get_error_message (err));
|
g_warning ("Cannot initialize libpolkit: %s", polkit_error_get_error_message (err));
|
||||||
polkit_error_free (err);
|
polkit_error_free (err);
|
||||||
|
|
||||||
polkit_context_unref (pol_ctx);
|
polkit_context_unref (global_context);
|
||||||
pol_ctx = NULL;
|
global_context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pol_ctx;
|
return global_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue