Skip to content

Commit

Permalink
Register packet as generational root. refs: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Jan 10, 2019
1 parent ac6be5a commit cbdb3ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ examples/Makefile.encode
examples/decode
examples/encode
._d/
.*sw*
13 changes: 12 additions & 1 deletion src/ogg_flac_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,19 @@ FLAC__StreamEncoderWriteStatus ogg_enc_write_callback(const FLAC__StreamEncoder
op.b_o_s = 0;
op.e_o_s = 0;
}

caml_acquire_runtime_system();
caml_callback(h->init_c,value_of_packet(&op));

value p = value_of_packet(&op);

caml_register_generational_global_root(&p);

value ret = caml_callback_exn(h->init_c,p);

caml_remove_generational_global_root(&p);

if (Is_exception_result(ret)) caml_raise(Extract_exception(ret));

caml_release_runtime_system();
}

Expand Down

0 comments on commit cbdb3ae

Please sign in to comment.