mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00: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
|
@ -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>
|
||||
|
||||
* gfilemonitor/glocaldirectorymonitor.c
|
||||
|
|
|
@ -76,20 +76,24 @@ pk_io_remove_watch (PolKitContext *pk_context, int watch_id)
|
|||
PolKitContext *
|
||||
create_polkit_context (void)
|
||||
{
|
||||
PolKitContext *pol_ctx;
|
||||
PolKitError *err = NULL;
|
||||
static PolKitContext *global_context = NULL;
|
||||
PolKitError *err;
|
||||
|
||||
pol_ctx = polkit_context_new ();
|
||||
polkit_context_set_io_watch_functions (pol_ctx, pk_io_add_watch, pk_io_remove_watch);
|
||||
if (!polkit_context_init (pol_ctx, &err)) {
|
||||
if (G_LIKELY (global_context))
|
||||
return polkit_context_ref (global_context);
|
||||
|
||||
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));
|
||||
polkit_error_free (err);
|
||||
|
||||
polkit_context_unref (pol_ctx);
|
||||
pol_ctx = NULL;
|
||||
polkit_context_unref (global_context);
|
||||
global_context = NULL;
|
||||
}
|
||||
|
||||
return pol_ctx;
|
||||
return global_context;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
Loading…
Reference in a new issue