fix memleak in mouseclick effect
REVIEW: 123114
This commit is contained in:
parent
219946edce
commit
da5328953a
1 changed files with 6 additions and 9 deletions
|
@ -64,9 +64,7 @@ MouseClickEffect::~MouseClickEffect()
|
||||||
{
|
{
|
||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
effects->stopMousePolling();
|
effects->stopMousePolling();
|
||||||
foreach (const MouseEvent* click, m_clicks) {
|
qDeleteAll(m_clicks);
|
||||||
delete click;
|
|
||||||
}
|
|
||||||
m_clicks.clear();
|
m_clicks.clear();
|
||||||
|
|
||||||
for (int i = 0; i < BUTTON_COUNT; ++i) {
|
for (int i = 0; i < BUTTON_COUNT; ++i) {
|
||||||
|
@ -166,13 +164,16 @@ void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MouseEvent* m = NULL;
|
MouseEvent* m = NULL;
|
||||||
for (int i = 0; i < BUTTON_COUNT; ++i) {
|
int i = BUTTON_COUNT;
|
||||||
|
while (--i >= 0) {
|
||||||
MouseButton* b = m_buttons[i];
|
MouseButton* b = m_buttons[i];
|
||||||
if (isPressed(b->m_button, buttons, oldButtons)) {
|
if (isPressed(b->m_button, buttons, oldButtons)) {
|
||||||
m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelDown), true);
|
m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelDown), true);
|
||||||
|
break;
|
||||||
} else if (isReleased(b->m_button, buttons, oldButtons) && (!b->m_isPressed || b->m_time > m_ringLife)) {
|
} else if (isReleased(b->m_button, buttons, oldButtons) && (!b->m_isPressed || b->m_time > m_ringLife)) {
|
||||||
// we might miss a press, thus also check !b->m_isPressed, bug #314762
|
// we might miss a press, thus also check !b->m_isPressed, bug #314762
|
||||||
m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelUp), false);
|
m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelUp), false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
b->setPressed(b->m_button & buttons);
|
b->setPressed(b->m_button & buttons);
|
||||||
}
|
}
|
||||||
|
@ -234,11 +235,7 @@ void MouseClickEffect::toggleEnabled()
|
||||||
effects->stopMousePolling();
|
effects->stopMousePolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_clicks.size() > 0) {
|
qDeleteAll(m_clicks);
|
||||||
foreach (const MouseEvent* click, m_clicks) {
|
|
||||||
delete click;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_clicks.clear();
|
m_clicks.clear();
|
||||||
|
|
||||||
for (int i = 0; i < BUTTON_COUNT; ++i) {
|
for (int i = 0; i < BUTTON_COUNT; ++i) {
|
||||||
|
|
Loading…
Reference in a new issue