This is log VLD:

Qt Code:
  1. WARNING: Visual Leak Detector detected memory leaks!
  2. ---------- Block 126 at 0x00B55388: 8 bytes ----------
  3. Call Stack:
  4. d:\project_ispa\ank_source\hsm_ank\hsm\server.cpp (47): Server::TimerShot
  5. d:\project_ispa\ank_source\hsm_ank\hsm\generatedfiles\debug\moc_server.cpp (67): Server::qt_metacall
  6. d:\qt4_4\src\corelib\kernel\qobject.cpp (3187): QMetaObject::activate
  7. d:\qt4_4\src\corelib\kernel\qobject.cpp (3257): QMetaObject::activate
  8. d:\qt4_4\src\corelib\tmp\moc\debug_shared\moc_qtimer.cpp (126): QTimer::timeout
  9. d:\qt4_4\src\corelib\kernel\qtimer.cpp (258): QTimer::timerEvent
  10. d:\qt4_4\src\corelib\kernel\qobject.cpp (1126): QObject::event
  11. d:\qt4_4\src\gui\kernel\qapplication.cpp (3770): QApplicationPrivate::notify_helper
  12. d:\qt4_4\src\gui\kernel\qapplication.cpp (3360): QApplication::notify
  13. d:\qt4_4\src\corelib\kernel\qcoreapplication.cpp (578): QCoreApplication::notifyInternal
  14. d:\qt4_4\src\corelib\kernel\qcoreapplication.h (205): QCoreApplication::sendEvent
  15. d:\qt4_4\src\corelib\kernel\qeventdispatcher_win.cpp (500): qt_internal_proc
  16. 0x7E368724 (File and line number not available): GetDC
  17. 0x7E368806 (File and line number not available): GetDC
  18. 0x7E3689BD (File and line number not available): GetWindowLongW
  19. 0x7E368A00 (File and line number not available): DispatchMessageW
  20. d:\qt4_4\src\corelib\kernel\qeventdispatcher_win.cpp (746): QEventDispatcherWin32::processEvents
  21. d:\qt4_4\src\gui\kernel\qapplication_win.cpp (1078): QGuiEventDispatcherWin32::processEvents
  22. d:\qt4_4\src\corelib\kernel\qeventloop.cpp (140): QEventLoop::processEvents
  23. d:\qt4_4\src\corelib\kernel\qeventloop.cpp (186): QEventLoop::exec
  24. d:\qt4_4\src\corelib\kernel\qcoreapplication.cpp (830): QCoreApplication::exec
  25. d:\qt4_4\src\gui\kernel\qapplication.cpp (3299): QApplication::exec
  26. d:\project_ispa\ank_source\hsm_ank\hsm\main.cpp (26): main
  27. d:\qt4_4\src\winmain\qtmain_win.cpp (133): WinMain
  28. f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (578): __tmainCRTStartup
  29. f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): WinMainCRTStartup
  30. 0x7C816FF7 (File and line number not available): RegisterWaitForInputIdle
  31. Data:
  32. 48 19 21 67 00 00 00 00 H.!g.... ........
  33.  
  34. ---------- Block 198 at 0x00B63FE8: 8 bytes ----------
  35. Call Stack:
  36. d:\project_ispa\ank_source\hsm_ank\hsm\server.cpp (47): Server::TimerShot
  37. d:\project_ispa\ank_source\hsm_ank\hsm\generatedfiles\debug\moc_server.cpp (67): Server::qt_metacall
  38. d:\qt4_4\src\corelib\kernel\qobject.cpp (3187): QMetaObject::activate
  39. d:\qt4_4\src\corelib\kernel\qobject.cpp (3257): QMetaObject::activate
  40. d:\qt4_4\src\corelib\tmp\moc\debug_shared\moc_qtimer.cpp (126): QTimer::timeout
  41. d:\qt4_4\src\corelib\kernel\qtimer.cpp (258): QTimer::timerEvent
  42. d:\qt4_4\src\corelib\kernel\qobject.cpp (1126): QObject::event
  43. d:\qt4_4\src\gui\kernel\qapplication.cpp (3770): QApplicationPrivate::notify_helper
  44. d:\qt4_4\src\gui\kernel\qapplication.cpp (3360): QApplication::notify
  45. d:\qt4_4\src\corelib\kernel\qcoreapplication.cpp (578): QCoreApplication::notifyInternal
  46. d:\qt4_4\src\corelib\kernel\qcoreapplication.h (205): QCoreApplication::sendEvent
  47. d:\qt4_4\src\corelib\kernel\qeventdispatcher_win.cpp (500): qt_internal_proc
  48. 0x7E368724 (File and line number not available): GetDC
  49. 0x7E368806 (File and line number not available): GetDC
  50. 0x7E3689BD (File and line number not available): GetWindowLongW
  51. 0x7E368A00 (File and line number not available): DispatchMessageW
  52. d:\qt4_4\src\corelib\kernel\qeventdispatcher_win.cpp (746): QEventDispatcherWin32::processEvents
  53. d:\qt4_4\src\gui\kernel\qapplication_win.cpp (1078): QGuiEventDispatcherWin32::processEvents
  54. d:\qt4_4\src\corelib\kernel\qeventloop.cpp (140): QEventLoop::processEvents
  55. d:\qt4_4\src\corelib\kernel\qeventloop.cpp (186): QEventLoop::exec
  56. d:\qt4_4\src\corelib\kernel\qcoreapplication.cpp (830): QCoreApplication::exec
  57. d:\qt4_4\src\gui\kernel\qapplication.cpp (3299): QApplication::exec
  58. d:\project_ispa\ank_source\hsm_ank\hsm\main.cpp (26): main
  59. d:\qt4_4\src\winmain\qtmain_win.cpp (133): WinMain
  60. f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (578): __tmainCRTStartup
  61. f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): WinMainCRTStartup
  62. 0x7C816FF7 (File and line number not available): RegisterWaitForInputIdle
  63. Data:
  64. 48 19 21 67 00 00 00 00 H.!g.... ........
  65.  
  66. ---------- Block 131 at 0x00BF27A8: 12 bytes ----------
  67. Call Stack:
  68. d:\project_ispa\ank_source\hsm_ank\hsm\server.cpp (38): Server::incomingConnection
  69. d:\qt4_4\src\network\socket\qtcpserver.cpp (185): QTcpServerPrivate::readNotification
  70. d:\qt4_4\src\network\socket\qabstractsocketengine.cpp (136): QAbstractSocketEngine::readNotification
  71. d:\qt4_4\src\network\socket\qnativesocketengine.cpp (985): QReadNotifier::event
  72. d:\qt4_4\src\gui\kernel\qapplication.cpp (3770): QApplicationPrivate::notify_helper
  73. d:\qt4_4\src\gui\kernel\qapplication.cpp (3360): QApplication::notify
  74. d:\qt4_4\src\corelib\kernel\qcoreapplication.cpp (578): QCoreApplication::notifyInternal
  75. d:\qt4_4\src\corelib\kernel\qcoreapplication.h (205): QCoreApplication::sendEvent
  76. d:\qt4_4\src\corelib\kernel\qeventdispatcher_win.cpp (461): qt_internal_proc
  77. 0x7E368724 (File and line number not available): GetDC
  78. 0x7E368806 (File and line number not available): GetDC
  79. 0x7E3689BD (File and line number not available): GetWindowLongW
  80. 0x7E368A00 (File and line number not available): DispatchMessageW
  81. d:\qt4_4\src\corelib\kernel\qeventdispatcher_win.cpp (746): QEventDispatcherWin32::processEvents
  82. d:\qt4_4\src\gui\kernel\qapplication_win.cpp (1078): QGuiEventDispatcherWin32::processEvents
  83. d:\qt4_4\src\corelib\kernel\qeventloop.cpp (140): QEventLoop::processEvents
  84. d:\qt4_4\src\corelib\kernel\qeventloop.cpp (186): QEventLoop::exec
  85. d:\qt4_4\src\corelib\kernel\qcoreapplication.cpp (830): QCoreApplication::exec
  86. d:\qt4_4\src\gui\kernel\qapplication.cpp (3299): QApplication::exec
  87. d:\project_ispa\ank_source\hsm_ank\hsm\main.cpp (26): main
  88. d:\qt4_4\src\winmain\qtmain_win.cpp (133): WinMain
  89. f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (578): __tmainCRTStartup
  90. f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): WinMainCRTStartup
  91. 0x7C816FF7 (File and line number not available): RegisterWaitForInputIdle
  92. Data:
  93. 48 19 21 67 00 00 00 00 C4 1D 00 00 H.!g.... ........
  94.  
  95. ...
  96. Visual Leak Detector detected 15 memory leaks.
  97. Visual Leak Detector is now exiting.
  98. The program '[3596] HSM.exe: Native' has exited with code 0 (0x0).
To copy to clipboard, switch view to plain text mode 

My code:

Qt Code:
  1. Server::Server(QObject *parent):QTcpServer(parent)
  2. {
  3. if (!listen(QHostAddress::Any, 1718))
  4. {
  5. return;
  6. }
  7. if(!db.CheckDbState())
  8. {
  9. db.CloseDB();
  10. }
  11. db.CloseDB();
  12. m_pTimer = new QTimer(this);
  13. connect(m_pTimer, SIGNAL(timeout()), this, SLOT(TimerShot()));
  14. m_pTimer->start(5000);
  15. }
  16.  
  17. Server::~Server()
  18. {
  19. if (m_pTimer != NULL)
  20. delete (m_pTimer);
  21. }
  22.  
  23. void Server::incomingConnection(int socketDescriptor)
  24. {
  25. thread = new FortuneThread(socketDescriptor,this);
  26. thread->start();
  27. }
  28.  
  29. void Server::TimerShot()
  30. {
  31.  
  32. WThread = new CWorkThread(this);
  33. WThread->start();
  34. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. class Server : public QTcpServer
  2. {
  3. Q_OBJECT
  4.  
  5.  
  6. public:
  7.  
  8. Server(QObject *parent = 0);
  9. ~Server();
  10.  
  11. protected:
  12.  
  13. void incomingConnection(int socketDescriptor);
  14.  
  15. db_work db;
  16. FortuneThread *thread;
  17. CWorkThread *WThread;
  18. QTimer *m_pTimer;
  19.  
  20. private slots:
  21. void TimerShot();
  22. };
To copy to clipboard, switch view to plain text mode 

wtf ???