mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kparts: disconnect the slotWidgetDestroyed() slot from KParts::Part::setAutoDeleteWidget() conditionally
fixes possible crash Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1ecd860cd3
commit
945f411733
1 changed files with 11 additions and 8 deletions
|
@ -132,13 +132,12 @@ Part::~Part()
|
|||
{
|
||||
Q_D(Part);
|
||||
|
||||
//kDebug(1000) << this;
|
||||
// kDebug(1000) << this;
|
||||
|
||||
if ( d->m_widget )
|
||||
{
|
||||
// We need to disconnect first, to avoid calling it !
|
||||
disconnect( d->m_widget, SIGNAL(destroyed()),
|
||||
this, SLOT(slotWidgetDestroyed()) );
|
||||
// We need to disconnect first to avoid calling slotWidgetDestroyed() !
|
||||
disconnect( d->m_widget, 0, this, 0 );
|
||||
}
|
||||
|
||||
if ( d->m_manager )
|
||||
|
@ -174,6 +173,13 @@ void Part::setAutoDeleteWidget(bool autoDeleteWidget)
|
|||
{
|
||||
Q_D(Part);
|
||||
d->m_autoDeleteWidget = autoDeleteWidget;
|
||||
if (d->m_widget) {
|
||||
if (autoDeleteWidget) {
|
||||
connect( d->m_widget, SIGNAL(destroyed()), this, SLOT(slotWidgetDestroyed()), Qt::UniqueConnection );
|
||||
} else {
|
||||
disconnect( d->m_widget, 0, this, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Part::setAutoDeletePart(bool autoDeletePart)
|
||||
|
@ -182,8 +188,6 @@ void Part::setAutoDeletePart(bool autoDeletePart)
|
|||
d->m_autoDeletePart = autoDeletePart;
|
||||
}
|
||||
|
||||
|
||||
|
||||
KIconLoader* Part::iconLoader()
|
||||
{
|
||||
Q_D(Part);
|
||||
|
@ -223,8 +227,7 @@ void Part::setWidget( QWidget *widget )
|
|||
{
|
||||
Q_D(Part);
|
||||
d->m_widget = widget;
|
||||
connect( d->m_widget, SIGNAL(destroyed()),
|
||||
this, SLOT(slotWidgetDestroyed()), Qt::UniqueConnection );
|
||||
connect( d->m_widget, SIGNAL(destroyed()), this, SLOT(slotWidgetDestroyed()), Qt::UniqueConnection );
|
||||
}
|
||||
|
||||
void Part::setSelectable( bool selectable )
|
||||
|
|
Loading…
Add table
Reference in a new issue