[Libreoffice] OSL_ASSERT - remove backtrace or make abort
tlillqvist at novell.com
Wed Apr 20 00:03:25 PDT 2011
I fully agree. We need to make it clear what assertions really mean, and how they should be used. Currently it is somewhat of a disaster area. There are places in the code that cause "assertion failures" every time the code is run if built with debug=t. So does that then mean that the code is actually horribly broken and works by accident? Probably not in all cases.
In my opinion, an assertion failure should mean that the program finds itself in a situation where it doesn't know what has happened or how to proceed; where it knows that its data structures are in an inconsistent state, and it will probably crash soon.
The current situation seems to be that assertions are used to indicate that something might be slightly suboptimal, but then the code is fully prepared to handle that anyway. More like it would be nagging "hey, somebody thought in 2005 that this should be fixed some day later".
Another related thing that is broken is how the code often loses useful information associated with exceptions.
To take an example, the root cause to much breakage on Windows in the 3.4 beta1 caused an exception with the nice message "package2.dll: cannot get symbol: component_getImplementationEnvironment" attached. That message says very clearly what the problem is. And the message indicates indeed a very serious problem with the UNO component shared library in question. But did this message show up anywhere (except that I by luck happened to see it in the debugger, as there was something to see, as the catch clause in this case actually caught the exception object)? Not anywhere where the user would have been able to report it at least.
More information about the LibreOffice