[glib: 2/8] gptrarray: Correctly set copied array length in g_ptr_array_copy()



commit b4943aa360f9db6f5319b14f077b7a071686d35e
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jul 16 10:15:57 2019 +0100

    gptrarray: Correctly set copied array length in g_ptr_array_copy()
    
    The allocation size was set correctly before, but not the array length,
    so the copied array appeared to have zero elements.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/garray.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/glib/garray.c b/glib/garray.c
index 075cb8d73..6e70f859e 100644
--- a/glib/garray.c
+++ b/glib/garray.c
@@ -1051,6 +1051,8 @@ g_ptr_array_copy (GPtrArray *array,
               array->len * sizeof (*array->pdata));
     }
 
+  new_array->len = array->len;
+
   return new_array;
 }
 


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