be a bit safer with the widget pointer; too easy to trigger with sloppy scripting

This commit is contained in:
Aaron Seigo 2011-06-03 12:53:32 +02:00
parent 0e9d609542
commit 592a6a63b3

View File

@ -251,6 +251,10 @@ ServiceJob *Service::startOperationCall(const KConfigGroup &description, QObject
void Service::associateWidget(QWidget *widget, const QString &operation)
{
if (!widget) {
return;
}
disassociateWidget(widget);
d->associatedWidgets.insert(widget, operation);
connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(associatedWidgetDestroyed(QObject*)));
@ -260,6 +264,10 @@ void Service::associateWidget(QWidget *widget, const QString &operation)
void Service::disassociateWidget(QWidget *widget)
{
if (!widget) {
return;
}
disconnect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedWidgetDestroyed(QObject*)));
d->associatedWidgets.remove(widget);