mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 23:06:10 -05:00
reduce memory corruption in voip plugin
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8282 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
807b7378df
commit
f803f1552c
1
TODO.txt
1
TODO.txt
@ -276,6 +276,7 @@ H [ ] get rid of the old cache system (remove CacheStrapper, CacheSource,
|
|||||||
GUI
|
GUI
|
||||||
H [ ] enable circles for channels/posted/forums
|
H [ ] enable circles for channels/posted/forums
|
||||||
E [ ] enable people dialog
|
E [ ] enable people dialog
|
||||||
|
E [ ] fix RSButtonOnText::eventFilter, and fix all places where RSButtonOnText gets deleted
|
||||||
|
|
||||||
GXS
|
GXS
|
||||||
H [ ] add the ability to use anonymous identities into circles. Needs new distribution model using items encrypted for multiple GXS keys.
|
H [ ] add the ability to use anonymous identities into circles. Needs new distribution model using items encrypted for multiple GXS keys.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
RSButtonOnText::RSButtonOnText(QWidget *parent)
|
RSButtonOnText::RSButtonOnText(QWidget *parent)
|
||||||
: QPushButton(parent)
|
: QPushButton(parent)
|
||||||
@ -81,6 +82,12 @@ RSButtonOnText::~RSButtonOnText()
|
|||||||
|
|
||||||
bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
|
bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
|
// comment electron:
|
||||||
|
// the guard is here, because someone deletes this object in callbacks(slots) called from here
|
||||||
|
// the QPointer can detect this
|
||||||
|
// but this is bad practice, because it hides the root cause for the problem,
|
||||||
|
// which is the deletion of objects in their own signals
|
||||||
|
// TODO: better use the Qt function deleteLater
|
||||||
QPointer<QAbstractButton> guard(this);
|
QPointer<QAbstractButton> guard(this);
|
||||||
QPoint point;
|
QPoint point;
|
||||||
if (isEventForThis(obj, event, point)) {
|
if (isEventForThis(obj, event, point)) {
|
||||||
@ -94,7 +101,7 @@ bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
|
|||||||
,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
|
,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
|
||||||
QPushButton::mousePressEvent(mouseEvent);
|
QPushButton::mousePressEvent(mouseEvent);
|
||||||
delete mouseEvent;
|
delete mouseEvent;
|
||||||
_pressed = true;
|
if (guard) _pressed = true;
|
||||||
//if (guard) emit pressed();
|
//if (guard) emit pressed();
|
||||||
if (guard) updateImage();
|
if (guard) updateImage();
|
||||||
}
|
}
|
||||||
@ -103,7 +110,7 @@ bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
|
|||||||
,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
|
,QPoint(1,1),Qt::LeftButton,Qt::LeftButton,0);
|
||||||
QPushButton::mouseReleaseEvent(mouseEvent);
|
QPushButton::mouseReleaseEvent(mouseEvent);
|
||||||
delete mouseEvent;
|
delete mouseEvent;
|
||||||
_pressed = false;
|
if (guard) _pressed = false;
|
||||||
//if (guard) emit released();
|
//if (guard) emit released();
|
||||||
//if (guard) emit clicked();
|
//if (guard) emit clicked();
|
||||||
//if (guard) if (isCheckable()) emit clicked(QPushButton::isChecked());
|
//if (guard) if (isCheckable()) emit clicked(QPushButton::isChecked());
|
||||||
@ -119,7 +126,7 @@ bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
|
|||||||
//QPushButton::setDown(true);
|
//QPushButton::setDown(true);
|
||||||
if (guard) emit mouseEnter();
|
if (guard) emit mouseEnter();
|
||||||
}
|
}
|
||||||
_mouseOver = true;
|
if (guard) _mouseOver = true;
|
||||||
if (guard) updateImage();
|
if (guard) updateImage();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -145,6 +152,9 @@ bool RSButtonOnText::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!guard)
|
||||||
|
std::cerr << "BIG FAT WARNING from RSButtonOnText::eventFilter(): i was deleted in my own event handler. This is bad practice. Please make a patch and use deleteLater to delay deletion." << std::endl;
|
||||||
|
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
return QWidget::eventFilter(obj, event);
|
return QWidget::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user