Explorar el Código

Add the missing destructor for `SourceData` C++ binding (#267)

方而静 hace 1 año
padre
commit
bcf51c4535
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      include/pocketpy/objects/sourcedata.hpp

+ 4 - 0
include/pocketpy/objects/sourcedata.hpp

@@ -11,6 +11,10 @@ struct SourceData : public pkpy_SourceData {
         pkpy_SourceData__ctor(this, source.data(), source.size(), &filename, mode);
     }
 
+    ~SourceData() {
+        pkpy_SourceData__dtor(this);
+    }
+
     std::string_view get_line(int lineno) const {
         const char *st, *ed;
         if (pkpy_SourceData__get_line(this, lineno, &st, &ed)) {