Project

General

Profile

Bug #3539

WTimer::singleShot() can leak memory

Added by Boris Nagaev almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
08/22/2014
Due date:
% Done:

0%

Estimated time:

Description

Here is implementation of WTimer::singleShot():

template

void WTimer::singleShot(int msec, const F& f)

{

WTimer *timer = new WTimer();

timer->setSingleShot(true);

timer->setInterval(msec);

timer->setSelfDestruct();

timer->start();

timer->timeout().connect(f);

}

timer deletes itself in "shot".

But it leaks if it never shots.

This can happen for the following reasons:

  • session deads before it shots,
  • memory leak attack.

Also available in: Atom PDF