For now, it's ok cause I'm not using the clipboard in our application, but still, any ideas of why this is happening?
Yes. The issue is with VirtualTree component sources.
Raises the exception, because ranges are in fact violated on registering a new clipboard format.
They're violated because CF_xxx variables are declared as WORD type (2-bytes in size). While LCL introduces a special TClipboardFormat (pointer size).
While "2-byte" happens (strictly speaking it's a matter of luck) to work on WinAPI and Gtk/Qt systems, it fails right away on Cocoa. (because Cocoa generated TClipboardFormat values are way beyond 2-byte size).
So, in order to make a "quick-fix" you can change the declaration of CF_xx variables, from:
var // Clipboard format IDs used in OLE drag'n drop and clipboard transfers.
CF_VIRTUALTREE,
CF_VTREFERENCE,
CF_VRTF,
CF_VRTFNOOBJS, // Unfortunately CF_RTF* is already defined as being
// registration strings so I have to use different identifiers.
CF_HTML,
CF_CSV: Word;
to
var // Clipboard format IDs used in OLE drag'n drop and clipboard transfers.
CF_VIRTUALTREE,
CF_VTREFERENCE,
CF_VRTF,
CF_VRTFNOOBJS, // Unfortunately CF_RTF* is already defined as being
// registration strings so I have to use different identifiers.
CF_HTML,
CF_CSV: TClipboardFormat;
BUT, it will eventually fail in run-time, because clipboard Format is often treated as WORD.
I tried to patch VT code (the patch is attached to this message) and replace any clipboard-format related declarations by TClipboardFormat, but I'm not sure if it's enough