Skip to content

Commit f71b2e6

Browse files
committed
Add __gc to blob
1 parent 2455d2f commit f71b2e6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/luaharfbuzz/blob.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ static int blob_new(lua_State *L) {
1313
return 1;
1414
}
1515

16+
static int blob_destroy(lua_State *L) {
17+
Blob *b = (Blob *)luaL_checkudata(L, 1, "harfbuzz.Blob");
18+
19+
hb_blob_destroy(*b);
20+
return 0;
21+
}
22+
1623
static int blob_new_from_file(lua_State *L) {
1724
Blob *b;
1825
const char *file_name = luaL_checkstring(L, 1);
@@ -44,6 +51,7 @@ static int blob_get_data(lua_State *L) {
4451
}
4552

4653
static const struct luaL_Reg blob_methods[] = {
54+
{ "__gc", blob_destroy },
4755
{ "get_length", blob_get_length },
4856
{ "get_data", blob_get_data },
4957
{ NULL, NULL }

0 commit comments

Comments
 (0)