[Github-comments] [geany/geany-plugins] Use "g_return_val_if_fail()" instead of producing an own error message. (109b8d0)

elextr notifications at xxxxx
Sat Aug 19 12:43:09 UTC 2017


Are you aware that its possible for distributions or others to build with G_DISABLE_CHECKS and the `g_return_val_if_failed` will be removed, so the function will crash on some poor user if their actions happen to result in the function being called with a NULL? 

Your documentation for the function doesn't disallow NULL, so you always need to reject it.  Probably better to use an if and `g_warning` or g_critical` for the message, which can be made to crash for easier debugging by setting G_DEBUG.

There have been some spirited Geany discussions about the "right" way to use these Glib debugging macros (IMHO there is none if the macro can be compiled out, unless you can prove by analysis or exhaustive testing that the failure cannot occur to the above mentioned innocent user, but if you can do that you don't need the test in the first place).  Its certainly the case that Geany itself is still subject to the problem referred to above.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/commit/109b8d079a59ba35e8aba5da960fc5b10f03ea7f#commitcomment-23741318
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170819/69d4614b/attachment.html>


More information about the Github-comments mailing list