Guessing that since win and btn go out of scope at end of main(), maybe they get cleaned up? I usually set things that need to persist into backend past main as global variables, or at least i have in the past.
On Wednesday, March 2, 2016 3:49 PM, Chris Angelico rosuav@gmail.com wrote:
int main() { GTK2.setup_gtk(); object btn=GTK2.Button("Raise an exception"); object win=GTK2.Window(0)->add(btn)->show_all(); win->signal_connect("destroy",lambda() {exit(0);}); btn->signal_connect("clicked",lambda() {error("Baboom!\n");}); return -1; }
Run this, click the button, then close the window. Pike will segfault.
Running a --with-debug Pike under gdb shows that the actual segfault occurs in backend_callback (defined in GTK2/source/global.pre), where it calls into the low end main loop for an iteration. Not immediately helpful.
I suspect that something's getting corrupted - maybe in the Pike stack, maybe something gets freed in GTK that should have another reference - when the exception happens. How can I go about tracking this down? Where would I put probes to watch for unexpected changes?
ChrisA