Project

General

Profile

Actions

Bug #3539

closed
BN KD

WTimer::singleShot() can leak memory

Bug #3539: WTimer::singleShot() can leak memory

Added by Boris Nagaev about 12 years ago. Updated almost 12 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.

KD Updated by Koen Deforche almost 12 years ago Actions #1

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.3.4

Ah, good observation, fixed!

KD Updated by Koen Deforche almost 12 years ago Actions #2

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom