[DefineTextTag] Honour TextMatrix
[Timer] Fix a reference counting bug

_setRepeatCount was errorneously decReffing even when the instance was
not being used by the timer thread. This could cause the Timer
instance to be deleted while some references still existed. Use a
smartref to ensure correct reference counting.