GNOME Bugzilla – Bug 528476
Calls System.Environment.Exit() while the GTK main loop is still running
Last modified: 2014-05-26 07:04:01 UTC
Hi, tomboy currently calls System.Environment.Exit() while the main loop is still running in several places. This will cause tomboy to segfault on exit as: - libgnome stores a global copy of the first created Gnome.Application and unrefs it in a atexit() handler - gtk# uses toggle refs => after exit() the Gnome.Application will be unreffed and the toggle ref notify (which is in managed land and doesn't exist anymore after exit()) will be called and boom. gtk#/gnome# have a workaround for this now but this only works when then main loop is stopped before calling exit. So please stop your main loops before exit, thanks :)
*** Bug 549828 has been marked as a duplicate of this bug. ***
*** Bug 524160 has been marked as a duplicate of this bug. ***
I'm not getting this segfault anymore, I'm not sure why. But we certainly call Environment.Exit while the main loop is still running. Sebastian, what distro/version do you see this on, so I can reproduce again?
(In reply to comment #3) > I'm not getting this segfault anymore, I'm not sure why. But we certainly call > Environment.Exit while the main loop is still running. > > Sebastian, what distro/version do you see this on, so I can reproduce again? This was with gtk-sharp 2.12.0 and the corresponding gnome-sharp... it was fixed by a workaround in gtk-sharp 2.12.1 and it's corresponding gnome-sharp version. So it won't crash anymore but it's still not nice ;)
Won't crash but not nice: Are we going to do something about this 7 month old bug? I hope that libtomboy is going to die (or at least shrink) anyway.
This doesn't have anything to do with libtomboy. We should still audit our code to clean up the places we call System.Environment.Exit. It *is* targeted for this cycle.
Would be nice to get some kind of comment with the reasoning when closing a bug as WONTFIX
(In reply to comment #7) Basically, 1. no one has provided a patch. 2. no one is complaining about the issue 3. I don't think I understand the problem enough to fix it. If you want to guide me in the correct direction I am willing to give it a try.
Basically it's unclean to call exit() anywhere other than after your g_main_loop_run()... so you would just quit your mainloop instead of calling exit(), and then gracefully exit from there. Initially the problem was as described in comment 1 and caused funny crashes. This is mostly a problem when atexit() handlers are used, but even without it's not really clean and asking for problems.