QTimer使用Window Manager对象的所有句柄

时间:2015-05-20 09:24:02

标签: qt window-managers qtimer

我使用QTimer触发对函数的重复调用,但最终崩溃时出现以下错误

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.

正如this link中所述,计时器对象占用了这些句柄。有办法阻止这个吗?我的程序需要一直运行而不需要重新启动且没有用户输入,并且增加系统容量(正如一些人的建议)似乎只会延迟崩溃而不是阻止它。

计时器代码

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

不会在其他任何地方重新创建计时器。

0 个答案:

没有答案