[SOLVED] Nuklear segfault reading

Started by mudlee, December 24, 2019, 13:24:54

Previous topic - Next topic

mudlee

Merry Christmas!

I need help to parse SIGSEGV logs.
I decided to move from NanoVG to Nuklear and I did nothing really, just included the democode (https://gist.github.com/mudlee/c32e5e939fac792dc1e7721376116a0f) to prove it works and of course I'll be refactor it to be a UI framework. After a while it segfaults.

OK, in paralell adding Nuklear, I did a bigger refactor in the engine, and I experience the following. Just calling
new NuklearHandler()
right after I initiate my engine works and everything starts up, there is the demo Nuklear UI with fonts and texts and buttons.
After a while (1s-~5sec) the game shuts down with segfault. If I don't initiate NuklearHandler, my game does not even start, just hangs around. Obviously I screwed up something during the refactor, but I'd like to find what, but I have no info how to read these segfaults (https://gist.github.com/mudlee/534d973a7cc652f489217a6f04aa8bc2). Somewhere in the past one of you explained how to read it, but I can't find it.

spasi

The buffer containing font data must not be GCed or deallocated. It is being accessed directly by stb (e.g. for metrics, the stbtt_GetCodepointHMetrics call in your case), even after you initialize the font textures etc.

mudlee

Spasi you always suprise me. Answering that quickly even in the middle of Christmas... Must give you a huge thumbsup!

You're right, initiating the class does not bind it to anything, hence when the GC is active it will screw up everything. THX!

The other problem was that I accidentally deleted `glfwPollEvents` from the main loop...