Thunar NDEBUG and _thunar_assert macros

Alistair Buxton a.j.buxton at
Fri Nov 7 20:47:25 CET 2014


I was browsing the crash reports from again today
and I found something interesting in Thunar.

There is a bug report at

What is happening here is that thunar_file_is_directory is segfaulting
if file is NULL.


>From a first look at this function, it's impossible for it to
segfault. It is two lines, and the first line should return false if
file is NULL.

But there's a problem, in thunar-private.h:

What this block of code does is turn all those checks into null ops if
you do a release build.

It looks to me like what has happened here is those macros were
originally meant for debugging, but later people have relied on them
to catch errors, not realising they don't work in release mode. So in
release mode Thunar will just go ahead and use an invalid pointer. I'm
pretty sure this is the cause of the above segfault, and it can
probably cause silent memory corruption too, if a pointer is valid but
the wrong type.

Alistair Buxton
a.j.buxton at

More information about the Xfce4-dev mailing list