Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package glib2 for openSUSE:Factory checked 
in at 2022-07-09 16:59:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/glib2 (Old)
 and      /work/SRC/openSUSE:Factory/.glib2.new.1523 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "glib2"

Sat Jul  9 16:59:14 2022 rev:254 rq:987346 version:2.72.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/glib2/glib2.changes      2022-06-01 
17:34:28.894728009 +0200
+++ /work/SRC/openSUSE:Factory/.glib2.new.1523/glib2.changes    2022-07-09 
16:59:20.732463885 +0200
@@ -1,0 +2,10 @@
+Sun Jul  3 23:43:59 UTC 2022 - Emily Gonyer <emilyyr...@gmail.com>
+
+- Update to version 2.72.3
+  + Bugs fixed: glgo#GNOME/Glib!1941, glgo#GNOME/Glib!2597,
+    glgo#GNOME/Glib!2639, glgo#GNOME/Glib!2670,
+    glgo#GNOME/Glib!2703, glgo#GNOME/Glib!2709,
+    glgo#GNOME/Glib!2720, glgo#GNOME/Glib!2750,
+    glgo#GNOME/Glib!2687.
+
+-------------------------------------------------------------------

Old:
----
  glib-2.72.2.tar.xz

New:
----
  glib-2.72.3.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ glib2.spec ++++++
--- /var/tmp/diff_new_pack.LR8vbK/_old  2022-07-09 16:59:21.316464763 +0200
+++ /var/tmp/diff_new_pack.LR8vbK/_new  2022-07-09 16:59:21.320464769 +0200
@@ -30,7 +30,7 @@
 %define libgthread libgthread-%{libver}
 %bcond_without     systemtap
 Name:           glib2%{psuffix}
-Version:        2.72.2
+Version:        2.72.3
 Release:        0
 Summary:        General-Purpose Utility Library
 License:        LGPL-2.1-or-later

++++++ glib-2.72.2.tar.xz -> glib-2.72.3.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/NEWS new/glib-2.72.3/NEWS
--- old/glib-2.72.2/NEWS        2022-05-30 15:26:47.000000000 +0200
+++ new/glib-2.72.3/NEWS        2022-06-30 16:15:17.000000000 +0200
@@ -1,3 +1,18 @@
+Overview of changes in GLib 2.72.3
+==================================
+
+* Bugs fixed:
+ - #1941 disposing a non-cancelled inotify GFileMonitor causes deadlocks
+ - #2597 Crash in g_socket_client_enumerator_callback when proxy resolving
+ - #2639 xdgmime update breaks webkit2gtk file:// requests
+ - #2670 Growing memory when using cancellable in g_socket_client_connect_async
+ - !2703 glocalfilemonitor: Avoid file monitor destruction from event thread
+ - !2709 Backport !2707 ???credentials: macos: check for existence of 
LOCAL_PEERPID??? to glib-2-72
+ - !2720 Backport !2708 ???xdgmime: Fix broken file:// content type lookups 
for webkitgtk??? to glib-2-72
+ - !2750 Backport !2745 ???gsocketclient: Fix still-reachable references to 
cancellables??? to glib-2-72
+ - !2787 Backport !2742 ???proxyaddressenumerator: set error parameter more 
thoughtfully??? to glib-2-72
+
+
 Overview of changes in GLib 2.72.2
 ==================================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/glocalfilemonitor.c 
new/glib-2.72.3/gio/glocalfilemonitor.c
--- old/glib-2.72.2/gio/glocalfilemonitor.c     2022-05-30 15:26:47.000000000 
+0200
+++ new/glib-2.72.3/gio/glocalfilemonitor.c     2022-06-30 16:15:17.000000000 
+0200
@@ -348,7 +348,6 @@
                                     gint64              event_time)
 {
   gboolean interesting = TRUE;
-  GFileMonitor *instance = NULL;
 
   g_assert (!child || is_basename (child));
   g_assert (!rename_to || is_basename (rename_to));
@@ -359,9 +358,24 @@
 
   g_mutex_lock (&fms->lock);
 
-  /* monitor is already gone -- don't bother */
-  instance = g_weak_ref_get (&fms->instance_ref);
-  if (instance == NULL)
+  /* NOTE:
+   *
+   * We process events even if the file monitor has already been disposed.
+   * The reason is that we must not take a reference to the instance here as
+   * destroying it from the event handling thread will lead to a deadlock when
+   * taking the lock in _ih_sub_cancel.
+   *
+   * This results in seemingly-unbounded growth of the `event_queue` with the
+   * calls to `g_file_monitor_source_queue_event()`. However, each of those 
sets
+   * the ready time on the #GSource, which means that it will be dispatched in
+   * a subsequent iteration of the #GMainContext it???s attached to. At that
+   * point, `g_file_monitor_source_dispatch()` will return %FALSE, and this 
will
+   * trigger finalisation of the source. That will clear the `event_queue`.
+   *
+   * If the source is no longer attached, this will return early to prevent
+   * unbounded queueing.
+   */
+  if (g_source_is_destroyed ((GSource *) fms))
     {
       g_mutex_unlock (&fms->lock);
       return TRUE;
@@ -452,7 +466,6 @@
   g_file_monitor_source_update_ready_time (fms);
 
   g_mutex_unlock (&fms->lock);
-  g_clear_object (&instance);
 
   return interesting;
 }
@@ -599,9 +612,9 @@
 
   g_file_monitor_source_update_ready_time (fms);
 
-  g_mutex_unlock (&fms->lock);
-
   g_source_destroy ((GSource *) fms);
+
+  g_mutex_unlock (&fms->lock);
 }
 
 static void
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/gproxyaddressenumerator.c 
new/glib-2.72.3/gio/gproxyaddressenumerator.c
--- old/glib-2.72.2/gio/gproxyaddressenumerator.c       2022-05-30 
15:26:47.000000000 +0200
+++ new/glib-2.72.3/gio/gproxyaddressenumerator.c       2022-06-30 
16:15:17.000000000 +0200
@@ -25,6 +25,7 @@
 
 #include "gasyncresult.h"
 #include "ginetaddress.h"
+#include "gioerror.h"
 #include "glibintl.h"
 #include "gnetworkaddress.h"
 #include "gnetworkingprivate.h"
@@ -87,6 +88,20 @@
   gboolean                  supports_hostname;
   GList                    *next_dest_ip;
   GError                   *last_error;
+
+  /* ever_enumerated is TRUE after we've returned a result for the first time
+   * via g_proxy_address_enumerator_next() or _next_async(). If FALSE, we have
+   * never returned yet, and should return an error if returning NULL because
+   * it does not make sense for a proxy resolver to return NULL except on 
error.
+   * (Whereas a DNS resolver would return NULL with no error to indicate "no
+   * results", a proxy resolver would want to return "direct://" instead, so
+   * NULL without error does not make sense for us.)
+   *
+   * But if ever_enumerated is TRUE, then we must not report any further errors
+   * (except for G_IO_ERROR_CANCELLED), because this is an API contract of
+   * GSocketAddressEnumerator.
+   */
+  gboolean                  ever_enumerated;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GProxyAddressEnumerator, 
g_proxy_address_enumerator, G_TYPE_SOCKET_ADDRESS_ENUMERATOR)
@@ -171,8 +186,9 @@
   GSocketAddress *result = NULL;
   GError *first_error = NULL;
 
-  if (priv->proxies == NULL)
+  if (!priv->ever_enumerated)
     {
+      g_assert (priv->proxies == NULL);
       priv->proxies = g_proxy_resolver_lookup (priv->proxy_resolver,
                                               priv->dest_uri,
                                               cancellable,
@@ -180,7 +196,10 @@
       priv->next_proxy = priv->proxies;
 
       if (priv->proxies == NULL)
-       return NULL;
+       {
+         priv->ever_enumerated = TRUE;
+         return NULL;
+       }
     }
 
   while (result == NULL && (*priv->next_proxy || priv->addr_enum))
@@ -294,29 +313,37 @@
        }
     }
 
-  if (result == NULL && first_error)
+  if (result == NULL && first_error && (!priv->ever_enumerated || 
g_error_matches (first_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)))
     g_propagate_error (error, first_error);
   else if (first_error)
     g_error_free (first_error);
 
-  return result;
-}
+  if (result == NULL && error != NULL && *error == NULL && 
!priv->ever_enumerated)
+    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Unspecified 
proxy lookup failure");
 
+  priv->ever_enumerated = TRUE;
 
+  return result;
+}
 
 static void
 complete_async (GTask *task)
 {
   GProxyAddressEnumeratorPrivate *priv = g_task_get_task_data (task);
 
-  if (priv->last_error)
+  if (priv->last_error && (!priv->ever_enumerated || g_error_matches 
(priv->last_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)))
     {
       g_task_return_error (task, priv->last_error);
       priv->last_error = NULL;
     }
+  else if (!priv->ever_enumerated)
+    g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Unspecified 
proxy lookup failure");
   else
     g_task_return_pointer (task, NULL, NULL);
 
+  priv->ever_enumerated = TRUE;
+
+  g_clear_error (&priv->last_error);
   g_object_unref (task);
 }
 
@@ -388,6 +415,7 @@
        }
     }
 
+  priv->ever_enumerated = TRUE;
   g_task_return_pointer (task, result, g_object_unref);
   g_object_unref (task);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/gsocket.c 
new/glib-2.72.3/gio/gsocket.c
--- old/glib-2.72.2/gio/gsocket.c       2022-05-30 15:26:47.000000000 +0200
+++ new/glib-2.72.3/gio/gsocket.c       2022-06-30 16:15:17.000000000 +0200
@@ -6070,12 +6070,14 @@
                                       G_CREDENTIALS_NATIVE_TYPE,
                                       &cred);
 
+#ifdef LOCAL_PEERPID
             if (getsockopt (socket->priv->fd,
                             SOL_LOCAL,
                             LOCAL_PEERPID,
                             &pid,
                             &optlen) == 0)
               _g_credentials_set_local_peerid (ret, pid);
+#endif
           }
         else
           {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/gsocketclient.c 
new/glib-2.72.3/gio/gsocketclient.c
--- old/glib-2.72.2/gio/gsocketclient.c 2022-05-30 15:26:47.000000000 +0200
+++ new/glib-2.72.3/gio/gsocketclient.c 2022-06-30 16:15:17.000000000 +0200
@@ -1464,6 +1464,8 @@
   GSocketConnectable *connectable;
   GSocketAddressEnumerator *enumerator;
   GCancellable *enumeration_cancellable;
+  GCancellable *enumeration_parent_cancellable;  /* (nullable) (owned) */
+  gulong enumeration_cancelled_id;
 
   GSList *connection_attempts;
   GSList *successful_connections;
@@ -1483,7 +1485,12 @@
   data->task = NULL;
   g_clear_object (&data->connectable);
   g_clear_object (&data->enumerator);
+
+  g_cancellable_disconnect (data->enumeration_parent_cancellable, 
data->enumeration_cancelled_id);
+  g_clear_object (&data->enumeration_parent_cancellable);
+  data->enumeration_cancelled_id = 0;
   g_clear_object (&data->enumeration_cancellable);
+
   g_slist_free_full (data->connection_attempts, connection_attempt_unref);
   g_slist_free_full (data->successful_connections, connection_attempt_unref);
 
@@ -1501,6 +1508,7 @@
   GSocketClientAsyncConnectData *data; /* unowned */
   GSource *timeout_source;
   GCancellable *cancellable;
+  gulong cancelled_id;
   grefcount ref;
 } ConnectionAttempt;
 
@@ -1528,6 +1536,8 @@
       g_clear_object (&attempt->address);
       g_clear_object (&attempt->socket);
       g_clear_object (&attempt->connection);
+      g_cancellable_disconnect (g_task_get_cancellable (attempt->data->task), 
attempt->cancelled_id);
+      attempt->cancelled_id = 0;
       g_clear_object (&attempt->cancellable);
       g_clear_object (&attempt->proxy_addr);
       if (attempt->timeout_source)
@@ -2021,8 +2031,9 @@
   data->connection_attempts = g_slist_append (data->connection_attempts, 
attempt);
 
   if (g_task_get_cancellable (data->task))
-    g_cancellable_connect (g_task_get_cancellable (data->task), G_CALLBACK 
(on_connection_cancelled),
-                           g_object_ref (attempt->cancellable), 
g_object_unref);
+    attempt->cancelled_id =
+        g_cancellable_connect (g_task_get_cancellable (data->task), G_CALLBACK 
(on_connection_cancelled),
+                               g_object_ref (attempt->cancellable), 
g_object_unref);
 
   g_socket_connection_set_cached_remote_address ((GSocketConnection 
*)attempt->connection, address);
   g_debug ("GSocketClient: Starting TCP connection attempt");
@@ -2127,8 +2138,12 @@
 
   data->enumeration_cancellable = g_cancellable_new ();
   if (cancellable)
-    g_cancellable_connect (cancellable, G_CALLBACK (on_connection_cancelled),
-                           g_object_ref (data->enumeration_cancellable), 
g_object_unref);
+    {
+      data->enumeration_parent_cancellable = g_object_ref (cancellable);
+      data->enumeration_cancelled_id =
+          g_cancellable_connect (cancellable, G_CALLBACK 
(on_connection_cancelled),
+                                 g_object_ref (data->enumeration_cancellable), 
g_object_unref);
+    }
 
   enumerator_next_async (data, FALSE);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/tests/proxy-test.c 
new/glib-2.72.3/gio/tests/proxy-test.c
--- old/glib-2.72.2/gio/tests/proxy-test.c      2022-05-30 15:26:47.000000000 
+0200
+++ new/glib-2.72.3/gio/tests/proxy-test.c      2022-06-30 16:15:17.000000000 
+0200
@@ -41,9 +41,14 @@
  * connects to @server_addr anyway).
  *
  * The default GProxyResolver (GTestProxyResolver) looks at its URI
- * and returns [ "direct://" ] for "simple://" URIs, and [
- * proxy_a.uri, proxy_b.uri ] for other URIs. The other GProxyResolver
- * (GTestAltProxyResolver) always returns [ proxy_a.uri ].
+ * and returns [ "direct://" ] for "simple://" URIs, and
+ * [ proxy_a.uri, proxy_b.uri ] for most other URIs. It can also return
+ * invalid results for other URIs (empty://, invalid://,
+ * invalid-then-simple://, and simple-then-invalid://) to test error
+ * handling.
+ *
+ * The other GProxyResolver (GTestAltProxyResolver) always returns
+ * [ proxy_a.uri ].
  */
 
 typedef struct {
@@ -134,6 +139,28 @@
       proxies[0] = g_strdup ("direct://");
       proxies[1] = NULL;
     }
+  else if (g_str_has_prefix (uri, "empty://"))
+    {
+      proxies[0] = g_strdup ("");
+      proxies[1] = NULL;
+    }
+  else if (g_str_has_prefix (uri, "invalid://"))
+    {
+      proxies[0] = g_strdup ("????");
+      proxies[1] = NULL;
+    }
+  else if (g_str_has_prefix (uri, "invalid-then-simple://"))
+    {
+      proxies[0] = g_strdup ("????");
+      proxies[1] = g_strdup ("direct://");
+      proxies[2] = NULL;
+    }
+  else if (g_str_has_prefix (uri, "simple-then-invalid://"))
+    {
+      proxies[0] = g_strdup ("direct://");
+      proxies[1] = g_strdup ("????");
+      proxies[2] = NULL;
+    }
   else
     {
       /* Proxy A can only deal with "alpha://" URIs, not
@@ -824,11 +851,8 @@
 teardown_test (gpointer fixture,
               gconstpointer user_data)
 {
-  if (last_proxies)
-    {
-      g_strfreev (last_proxies);
-      last_proxies = NULL;
-    }
+  g_clear_pointer (&last_proxies, g_strfreev);
+
   g_clear_error (&proxy_a.last_error);
   g_clear_error (&proxy_b.last_error);
 }
@@ -1092,6 +1116,118 @@
 }
 
 static void
+test_invalid_uris_sync (gpointer fixture,
+                       gconstpointer user_data)
+{
+  GSocketConnection *conn;
+  gchar *uri;
+  GError *error = NULL;
+
+  g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/2597";);
+
+  /* The empty:// URI causes the proxy resolver to return an empty string. */
+  uri = g_strdup_printf ("empty://127.0.0.1:%u", server.server_port);
+  conn = g_socket_client_connect_to_uri (client, uri, 0, NULL, &error);
+  g_free (uri);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_assert_null (conn);
+  g_clear_error (&error);
+  g_clear_pointer (&last_proxies, g_strfreev);
+
+  /* The invalid:// URI causes the proxy resolver to return a cat emoji. */
+  uri = g_strdup_printf ("invalid://127.0.0.1:%u", server.server_port);
+  conn = g_socket_client_connect_to_uri (client, uri, 0, NULL, &error);
+  g_free (uri);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_assert_null (conn);
+  g_clear_error (&error);
+  g_clear_pointer (&last_proxies, g_strfreev);
+
+  /* If the proxy resolver returns an invalid URI before a valid URI,
+   * we should succeed.
+   */
+  uri = g_strdup_printf ("invalid-then-simple://127.0.0.1:%u", 
server.server_port);
+  conn = g_socket_client_connect_to_uri (client, uri, 0, NULL, &error);
+  g_free (uri);
+  g_assert_no_error (error);
+  do_echo_test (conn);
+  g_object_unref (conn);
+  g_clear_pointer (&last_proxies, g_strfreev);
+
+  /* If the proxy resolver returns a valid URI before an invalid URI,
+   * we should succeed.
+   */
+  uri = g_strdup_printf ("simple-then-invalid://127.0.0.1:%u", 
server.server_port);
+  conn = g_socket_client_connect_to_uri (client, uri, 0, NULL, &error);
+  g_free (uri);
+  g_assert_no_error (error);
+  do_echo_test (conn);
+  g_object_unref (conn);
+  g_clear_pointer (&last_proxies, g_strfreev);
+}
+
+static void
+test_invalid_uris_async (gpointer fixture,
+                        gconstpointer user_data)
+{
+  GSocketConnection *conn;
+  GError *error = NULL;
+  gchar *uri;
+
+  g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/2597";);
+
+  /* The empty:// URI causes the proxy resolver to return an empty string. */
+  uri = g_strdup_printf ("empty://127.0.0.1:%u", server.server_port);
+  g_socket_client_connect_to_uri_async (client, uri, 0, NULL,
+                                       async_got_error, &error);
+  g_free (uri);
+  while (error == NULL)
+    g_main_context_iteration (NULL, TRUE);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+  g_clear_pointer (&last_proxies, g_strfreev);
+
+  /* The invalid:// URI causes the proxy resolver to return a cat emoji. */
+  uri = g_strdup_printf ("invalid://127.0.0.1:%u", server.server_port);
+  g_socket_client_connect_to_uri_async (client, uri, 0, NULL,
+                                       async_got_error, &error);
+  g_free (uri);
+  while (error == NULL)
+    g_main_context_iteration (NULL, TRUE);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+  g_clear_pointer (&last_proxies, g_strfreev);
+
+  /* If the proxy resolver returns an invalid URI before a valid URI,
+   * we should succeed.
+   */
+  uri = g_strdup_printf ("invalid-then-simple://127.0.0.1:%u", 
server.server_port);
+  conn = NULL;
+  g_socket_client_connect_to_uri_async (client, uri, 0, NULL,
+                                       async_got_conn, &conn);
+  g_free (uri);
+  while (conn == NULL)
+    g_main_context_iteration (NULL, TRUE);
+  do_echo_test (conn);
+  g_object_unref (conn);
+  g_clear_pointer (&last_proxies, g_strfreev);
+
+  /* If the proxy resolver returns a valid URI before an invalid URI,
+   * we should succeed.
+   */
+  uri = g_strdup_printf ("simple-then-invalid://127.0.0.1:%u", 
server.server_port);
+  conn = NULL;
+  g_socket_client_connect_to_uri_async (client, uri, 0, NULL,
+                                       async_got_conn, &conn);
+  g_free (uri);
+  while (conn == NULL)
+    g_main_context_iteration (NULL, TRUE);
+  do_echo_test (conn);
+  g_object_unref (conn);
+  g_clear_pointer (&last_proxies, g_strfreev);
+}
+
+static void
 test_dns (gpointer fixture,
          gconstpointer user_data)
 {
@@ -1370,6 +1506,8 @@
   g_test_add_vtable ("/proxy/single_async", 0, NULL, setup_test, 
test_single_async, teardown_test);
   g_test_add_vtable ("/proxy/multiple_sync", 0, NULL, setup_test, 
test_multiple_sync, teardown_test);
   g_test_add_vtable ("/proxy/multiple_async", 0, NULL, setup_test, 
test_multiple_async, teardown_test);
+  g_test_add_vtable ("/proxy/invalid-uris-sync", 0, NULL, setup_test, 
test_invalid_uris_sync, teardown_test);
+  g_test_add_vtable ("/proxy/invalid-uris-async", 0, NULL, setup_test, 
test_invalid_uris_async, teardown_test);
   g_test_add_vtable ("/proxy/dns", 0, NULL, setup_test, test_dns, 
teardown_test);
   g_test_add_vtable ("/proxy/override", 0, NULL, setup_test, test_override, 
teardown_test);
   g_test_add_func ("/proxy/enumerator-ports", test_proxy_enumerator_ports);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/tests/testfilemonitor.c 
new/glib-2.72.3/gio/tests/testfilemonitor.c
--- old/glib-2.72.2/gio/tests/testfilemonitor.c 2022-05-30 15:26:47.000000000 
+0200
+++ new/glib-2.72.3/gio/tests/testfilemonitor.c 2022-06-30 16:15:17.000000000 
+0200
@@ -1036,6 +1036,57 @@
   g_object_unref (data.output_stream);
 }
 
+static void
+test_finalize_in_callback (Fixture       *fixture,
+                           gconstpointer  user_data)
+{
+  GFile *file = NULL;
+  guint i;
+
+  g_test_summary ("Test that finalization of a GFileMonitor in one of its "
+                  "callbacks doesn???t cause a deadlock.");
+  g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/1941";);
+
+  file = g_file_get_child (fixture->tmp_dir, "race-file");
+
+  for (i = 0; i < 50; i++)
+    {
+      GFileMonitor *monitor = NULL;
+      GError *local_error = NULL;
+
+      /* Monitor the file. */
+      monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, 
&local_error);
+      g_assert_no_error (local_error);
+      g_assert_nonnull (monitor);
+
+      /* Create the file. */
+      g_file_replace_contents (file, "hello", 5, NULL, FALSE,
+                               G_FILE_CREATE_NONE, NULL, NULL, &local_error);
+      g_assert_no_error (local_error);
+
+      /* Immediately drop the last ref to the monitor in the hope that this
+       * happens in the middle of the critical section in
+       * g_file_monitor_source_handle_event(), so that any cleanup at the end
+       * of that function is done with a now-finalised file monitor. */
+      g_object_unref (monitor);
+
+      /* Re-create the monitor and do the same again for deleting the file, to
+       * give a second chance at hitting the race condition. */
+      monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, 
&local_error);
+      g_assert_no_error (local_error);
+      g_assert_nonnull (monitor);
+
+      /* Delete the file. */
+      g_file_delete (file, NULL, &local_error);
+      g_assert_no_error (local_error);
+
+      /* Drop the ref again. */
+      g_object_unref (monitor);
+    }
+
+  g_object_unref (file);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -1047,6 +1098,7 @@
   g_test_add ("/monitor/dir-not-existent", Fixture, NULL, setup, 
test_dir_non_existent, teardown);
   g_test_add ("/monitor/cross-dir-moves", Fixture, NULL, setup, 
test_cross_dir_moves, teardown);
   g_test_add ("/monitor/file/hard-links", Fixture, NULL, setup, 
test_file_hard_links, teardown);
+  g_test_add ("/monitor/finalize-in-callback", Fixture, NULL, setup, 
test_finalize_in_callback, teardown);
 
   return g_test_run ();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/gio/xdgmime/xdgmimecache.c 
new/glib-2.72.3/gio/xdgmime/xdgmimecache.c
--- old/glib-2.72.2/gio/xdgmime/xdgmimecache.c  2022-05-30 15:26:47.000000000 
+0200
+++ new/glib-2.72.3/gio/xdgmime/xdgmimecache.c  2022-06-30 16:15:17.000000000 
+0200
@@ -568,17 +568,17 @@
       n_entries = GET_UINT32 (cache->buffer, list_offset);
       offset = GET_UINT32 (cache->buffer, list_offset + 4);
 
-      n = cache_glob_node_lookup_suffix (cache, 
-                                        n_entries, offset, 
-                                        file_name, len,
-                                        ignore_case,
-                                        mime_types,
-                                        n_mime_types);
-      if (n > 0)
-       return n;
+      n += cache_glob_node_lookup_suffix (cache,
+                                         n_entries, offset,
+                                         file_name, len,
+                                         ignore_case,
+                                         mime_types + n,
+                                         n_mime_types - n);
+      if (n == n_mime_types)
+       break;
     }
 
-  return 0;
+  return n;
 }
 
 static int compare_mime_weight (const void *a, const void *b)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glib-2.72.2/meson.build new/glib-2.72.3/meson.build
--- old/glib-2.72.2/meson.build 2022-05-30 15:26:47.000000000 +0200
+++ new/glib-2.72.3/meson.build 2022-06-30 16:15:17.000000000 +0200
@@ -1,5 +1,5 @@
 project('glib', 'c', 'cpp',
-  version : '2.72.2',
+  version : '2.72.3',
   # NOTE: We keep this pinned at 0.52 because that's what Debian Stable ships
   meson_version : '>= 0.52.0',
   default_options : [

Reply via email to