gmain: Handle case where source id overflows

0 is not a valid source id, but for long-lived programs that rapidly
create/destroy sources, it's possible for the source id to overflow.
We should handle this, because the documentation implies we will.

https://bugzilla.gnome.org/show_bug.cgi?id=687098
This commit is contained in:
Colin Walters
2012-11-08 09:12:25 -05:00
parent 606aa26acf
commit b98a1c8df3
4 changed files with 165 additions and 6 deletions

View File

@@ -27,6 +27,8 @@ G_GNUC_INTERNAL
GMainContext * g_get_worker_context (void);
G_GNUC_INTERNAL
gboolean g_check_setuid (void);
G_GNUC_INTERNAL
GMainContext * g_main_context_new_with_next_id (guint next_id);
#define GLIB_PRIVATE_CALL(symbol) (glib__private__()->symbol)
@@ -41,9 +43,10 @@ typedef struct {
/* See gmain.c */
GMainContext * (* g_get_worker_context) (void);
/* Add other private functions here, initialize them in glib-private.c */
gboolean (* g_check_setuid) (void);
GMainContext * (* g_main_context_new_with_next_id) (guint next_id);
/* Add other private functions here, initialize them in glib-private.c */
} GLibPrivateVTable;
GLibPrivateVTable *glib__private__ (void);