protect the pointer here as well

This commit is contained in:
Aaron Seigo 2011-06-03 12:56:11 +02:00
parent 592a6a63b3
commit c109e2369b

View File

@ -275,6 +275,10 @@ void Service::disassociateWidget(QWidget *widget)
void Service::associateWidget(QGraphicsWidget *widget, const QString &operation) void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
{ {
if (!widget) {
return;
}
disassociateWidget(widget); disassociateWidget(widget);
d->associatedGraphicsWidgets.insert(widget, operation); d->associatedGraphicsWidgets.insert(widget, operation);
connect(widget, SIGNAL(destroyed(QObject*)), connect(widget, SIGNAL(destroyed(QObject*)),
@ -285,6 +289,10 @@ void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
void Service::disassociateWidget(QGraphicsWidget *widget) void Service::disassociateWidget(QGraphicsWidget *widget)
{ {
if (!widget) {
return;
}
disconnect(widget, SIGNAL(destroyed(QObject*)), disconnect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*))); this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
d->associatedGraphicsWidgets.remove(widget); d->associatedGraphicsWidgets.remove(widget);