Hi
In development I use sync for hot code upgrade. Sometimes it reloads modules that not changed. And that behavior helped me to discover segmentation fault of jsonx.
The problem was in jsonx.c:64 as you can see. We should reinit or save our priv_data without changes. That is how I fixed this problem.
Also you can say that jsonx nif doesn't support hot code upgarade -> ERL_NIF_INIT(jsonx, nif_funcs, load, NULL, NULL, NULL);
Also I added enif_free to make unload more correct and match with ok in jsonx.erl:234 to exclude unexpected return values.
Thanks to @ten0s for help in debug.
I hope you like this fix.
Hi In development I use sync for hot code upgrade. Sometimes it reloads modules that not changed. And that behavior helped me to discover segmentation fault of jsonx. The problem was in jsonx.c:64 as you can see. We should reinit or save our priv_data without changes. That is how I fixed this problem. Also you can say that jsonx nif doesn't support hot code upgarade -> ERL_NIF_INIT(jsonx, nif_funcs, load, NULL, NULL, NULL); Also I added enif_free to make unload more correct and match with ok in jsonx.erl:234 to exclude unexpected return values. Thanks to @ten0s for help in debug. I hope you like this fix.