From 8f34e90bc39726a250688c3a8f74ad3c8f33b2af Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Wed, 31 Jan 2024 11:56:56 -0600 Subject: [PATCH] Link to the main context tutorial from the main loop docs This might help increase visibility of Philip's useful GMainContext tutorial. Although the GMainContext documentation is fairly good, it's also pretty intimidating. The tutorial is very useful and provides guidance that we can't fit directly into the documentation, so reference it. --- docs/reference/glib/main-loop.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/reference/glib/main-loop.md b/docs/reference/glib/main-loop.md index bd63b201d..b89bc0768 100644 --- a/docs/reference/glib/main-loop.md +++ b/docs/reference/glib/main-loop.md @@ -105,3 +105,14 @@ the source is finalized, and is designed for releasing references like this. One important caveat of this second approach is that it will keep the object alive indefinitely if the main loop is stopped before the `GSource` is invoked, which may be undesirable. + +## Tutorial + +`GMainContext` is complicated, and can be particularly intimidating for +developers new to working with GLib. Unfortunately, improper use of +`GMainContext` often results in bugs that may be difficult to debug. The +[Main Contexts tutorial](https://developer.gnome.org/documentation/tutorials/main-contexts.html) +provides valuable guidance for developers working with `GMainContext` +and is highly recommended reading. In particular, the section +[Using GMainContext in a Library](https://developer.gnome.org/documentation/tutorials/main-contexts.html#using-gmaincontext-in-a-library) +documents several pitfalls that library authors should avoid.