[gegl] buffer: improve deadlock prevention in gegl_buffer_copy()



commit b3b9a943605f24b3494baec740d7e677db095c35
Author: Ell <ell_se yahoo com>
Date:   Sun May 5 08:36:37 2019 -0400

    buffer: improve deadlock prevention in gegl_buffer_copy()
    
    In gegl_buffer_copy(), when using COW, sort the locks by the tile-
    storage pointers, instead of the buffer pointers, to avoid the
    possibility of a deadlock when different buffers use the same
    underlying storage in concurrent calls to the function.

 gegl/buffer/gegl-buffer-access.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index d4d54f617..0a48bbc9b 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -2465,7 +2465,7 @@ gegl_buffer_copy (GeglBuffer          *src,
              */
             fast_copy = (src->tile_storage->n_user_handlers == 0);
 
-            if (src < dst)
+            if (src->tile_storage < dst->tile_storage)
               {
                 g_rec_mutex_lock (&src->tile_storage->mutex);
                 g_rec_mutex_lock (&dst->tile_storage->mutex);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]