On Aug 2, 2013, at 1:37 PM, Markus Engel wrote:
So far, only the crash with the text tool can be reproduced consistently (after 4 or at most ~8 times tapping the space bar).
However, with some patience I'm able to make your branch crash when tool-switching with other tools as well:
The backtrace looks like a double-free. There could be some leftover manual calls to member constructors / destructors in InkNodeTool >and SPTextContext.
Regards, Krzysztof
Hm, I didn't find any, but I'm sure this has got to do with the way I rewrote the part that switches the tools, see src/desktop.cpp:675. The old method is right underneath it, commented out. I reordered it, maybe this will help. Could you try it out once more? If you just comment out line 691 ("delete ec_old;"), does it still crash?
*if* you can make it happen under Valgrind, that would probably the the fastest way to pinpoint it. Of course, running under valgrind does slow operation down significantly...
Otherwise if it is a double-free issue, you can often spot it by ensuring members are set to 0 after deleting. That will shift things to a null-pointer dereference which is a much more immediate crash and easily visible dump.