summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-02-13 10:18:03 -0500
committerRyan Lortie <desrt@desrt.ca>2014-02-20 18:32:42 -0500
commit0415930b499fa951f1e82d38fc60461a8bd42c4b (patch)
tree79d757980ded5a3924b0716a03e2855c5af05962 /glib
parent8491f03581b6ada1d82f29064c99b604e98c7e09 (diff)
gsource: document priority of child sources
Add a note to the documentation that child sources cannot have their priority changed independently from their parent. Add a g_return_if_fail() to the public API in order to enforce this. This was already a reality due to the check in g_source_set_priority_unlocked(), but it was never explicitly documented. https://bugzilla.gnome.org/show_bug.cgi?id=724706
Diffstat (limited to 'glib')
-rw-r--r--glib/gmain.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/glib/gmain.c b/glib/gmain.c
index c65d24fbb..e74590a86 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1706,6 +1706,10 @@ g_source_set_priority_unlocked (GSource *source,
* source will be dispatched if it is ready to be dispatched and no
* sources at a higher (numerically smaller) priority are ready to be
* dispatched.
+ *
+ * A child source always has the same priority as its parent. It is not
+ * permitted to change the priority of a source once it has been added
+ * as a child of another source.
**/
void
g_source_set_priority (GSource *source,
@@ -1714,6 +1718,7 @@ g_source_set_priority (GSource *source,
GMainContext *context;
g_return_if_fail (source != NULL);
+ g_return_if_fail (source->priv->parent_source == NULL);
context = source->context;