Sfoglia il codice sorgente

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

方而静 2 anni fa
parent
commit
bcf51c4535
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  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);
         pkpy_SourceData__ctor(this, source.data(), source.size(), &filename, mode);
     }
     }
 
 
+    ~SourceData() {
+        pkpy_SourceData__dtor(this);
+    }
+
     std::string_view get_line(int lineno) const {
     std::string_view get_line(int lineno) const {
         const char *st, *ed;
         const char *st, *ed;
         if (pkpy_SourceData__get_line(this, lineno, &st, &ed)) {
         if (pkpy_SourceData__get_line(this, lineno, &st, &ed)) {