2

I am using a QTimer to trigger a recurring call to a function, however it eventually crashed with the following errors

QEventDispatcherWin32::registerTimer: Failed to create a timer (The current process has used all of its system allowance of handles for Window Manager objects.)
struct HWND__ *__cdecl qt_create_internal_window(const class QEventDispatcherWin32 *): CreateWindow() for QEventDispatcherWin32 internal window failed (The current process has used all of its system allowance of handles for Window Manager objects.)
Qt: INTERNAL ERROR: failed to install GetMessage hook: 1158, The current process has used all of its system allowance of handles for Window Manager objects.

And as stated in this link, timer objects take up these handles. Is there a way to stop this? My program needs to be running all the time without being restarted and without user input, and increasing the system allowance (as some people suggest) seems like it would just delay the crash rather than prevent it.

Timer code

QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(mFunc()));
timer->start(15000);

The timer is not recreated anywhere else.

Cob50nm
  • 911
  • 2
  • 9
  • 27
  • 1
    how many time do you call the "timer code"? You are probably calling this code repetitively until you run out of handle. – UmNyobe May 20 '15 at 12:11
  • Just the once, I checked by updating a text view with the current time immediately after `timer->start(15000)` It is in the constructor for my `MainWindow` – Cob50nm May 20 '15 at 13:52

0 Answers0