Monday, December 24, 2012

Merry Christmas and decent bug reports to everyone!

Merry Christmas to all the KDE devs and users!

Yesterday I finally fixed an often reported crash (bug #299077). Fact is, I'm still celebrating this achievement since that used to be a really mysterious crash. With this post, I would like to thank the user "wodencafe" who provided the bit of detail that made it possible to fix the crash.

Now I know this crash was very trivial. Basically, since plasma-desktop is a process, and applets are merely c++ objects in memory that get created and deleted over time, a leaked instance of dynamically allocated variable in one of the applets may remain in the plasma-desktop process memory until it is quit (restarted). In this case, it was an item view, whose parent was never deleted properly. What made things worse is that the model that view was using got deleted properly on applet removal. So, this leaked itemview kept receiving signals on plasma theme change, and then tried to dereference the (already-invalid) model pointer. Voila!

Moral of the story: a good bug report is one of the best things we could wish to a fellow programmer. The key bit of information, in this case, was that you had to remove the applet from the panel to trigger the leaked item view state.

Also, I'd like to thank dfaure for teaching me to use the debugger any time I have questions about the program. Sound simple, but still :)

While I am at it,  I'd like to ask the C++ experts (hope that the Qt devs read the Planet and this blog post): is it 100% safe to assume that calling the delete operator on a 0 pointer will not crash on any platform / compiler / libc implementation? Or is it, in the general sense, not quite guaranteed? Thank you!


  1. Deleting nullptr_t is safe.

    Cheers, and decent bug reports to you too - I really like that :)

  2. Calling delete on 0 is guaranteed to work by the standard. Similarly so is calling free(0) in C.

  3. Just for the record: You don't need to push bug fixes to multiple branches in kde-baseapps. We do merge KDE/4.9 into KDE/4.10 and KDE/4.10 into master regularly. Your commit now shows up three times in the master's log ;-)