[gjs: 1/10] function: Prevent copying of GjsFunctionCallState




commit a30da63eac6b8875e6ce51894b0d512a93bb8948
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Mar 12 11:09:15 2021 -0800

    function: Prevent copying of GjsFunctionCallState
    
    This class is meant to be allocated once, on the stack, and passed by
    reference. Copying it would reallocate the in and out C-values arrays,
    which would be bad.

 gi/function.h | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gi/function.h b/gi/function.h
index 74143c4c..034c8d50 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -118,6 +118,9 @@ struct GjsFunctionCallState {
         delete[](inout_original_cvalues - first_arg_offset());
     }
 
+    GjsFunctionCallState(const GjsFunctionCallState&) = delete;
+    GjsFunctionCallState& operator=(const GjsFunctionCallState&) = delete;
+
     constexpr int first_arg_offset() const { return is_method ? 2 : 1; }
 
     constexpr bool did_throw_gerror() const {


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