Second try of my previous pull request, which was partially reverted due to caused crashes and memory leaks
This will (hopefully) solve the memory leaks in dynamic ribbons and image button widgets
Issue #1588

Fixed crashes in track info screen
Check texture cache before adding an icon button's disabled texture
Let all SFX commands be handled by the sfx manager thread (otherwise
events could be handled in the wrong order, e.g. a delete from the
main thread before the play in the manager thread, resulting in a crash).
Should fix #1511 and #1604.
Use case-insensitive comparison for animated textures, for some reason
Removed status check when queueing sfx, to get more consistent
runtime behaviour.
Added computation of the duration of a sound buffer (unused atm).
Fixed compiler warning.