This is the code of the elisp timer. This is actually a bug fix.

(defun check-frames-connection-timer ()
(safe-check-frames-connection)
(run-at-time 2 nil 'check-frames-connection-timer))
(run-at-time 2 nil 'check-frames-connection-timer)
(defun safe-x-check-frame (frame)
(condition-case nil
(x-check-frame frame)
(error nil)))
(defun safe-check-frames-connection ()
(when (functionp 'x-check-frame)
(dolist (frame (frame-list))
(when (eq (framep frame) 'x)
(safe-x-check-frame frame)))))