gmain: Simplify source id tracking
authorRyan Lortie <desrt@desrt.ca>
Sat, 8 Feb 2014 12:17:10 +0000 (12:17 +0000)
committerRyan Lortie <desrt@desrt.ca>
Mon, 24 Feb 2014 14:28:43 +0000 (09:28 -0500)
commit9e81709012f27eebe336f40f948e9493c87fc75b
tree45cb1d635a3c2acfa0a920e52cb3b456f57c9598
parente7bde4acf4499d353780b696435e1a43dee66c54
gmain: Simplify source id tracking

Simplify our tracking of issued source id integers and fix some bugs.

Previously the source's id was remove from the 'used' table from
source_remove_from_context() which was also called if the source
priority was changed (in which case it would never be added back to the
table).  The source id could be reissued in that case.

In the new approach, we just always keep a hash table of sources, by
source id.  This simplifies the logic and will also allow us to improve
performance of g_main_context_find_source_by_id() which is called in some
fairly common cases, such as g_source_remove().  These improvements will be in
the following commits.

https://bugzilla.gnome.org/show_bug.cgi?id=724839
glib/gmain.c