Skip to content

Fix error when displaying custom date format in details view (issue #389)

Fixes a bug caused by use of a shared static struct tm by taking a copy of the struct to pass to exo_strdup_strftime rather than passing a pointer to the shared struct.

This fix takes the simple approach of just copying the shared static struct tm rather than using more modern functions like localtime_r, since using such functions would require adding a check to the configure script and adding #ifdefs in the code (and in any case one would need fallback code that just does a copy for non-POSIX systems). The only disadvantage of this approach vs localtime_r is that it is not thread-safe, so it is possible that some other thread could modify the static struct tm during the copying operation. I don't know how likely it is that there would be other threads running that might call some function that modifies the static value, but it seems pretty unlikely that this would happen, and the consequences are not serious if it were to happen (it won't crash Thunar, all it will do is display a bad date), so this should work OK (but I'm happy to do a more thorough implementation if that would be better).

Merge request reports