bugfix: trash-plugin crash when change mode

Change-Id: If21161bb521af3c804999174ca6118cacbad070e
This commit is contained in:
杨万青 2015-08-31 20:35:58 +08:00
parent 930ed1fadc
commit 2ad69dd66f
Notes: Deepin Code Review 2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: <mr.asianwang@gmail.com>
Submitted-by: <mr.asianwang@gmail.com>
Submitted-at: Tue, 01 Sep 2015 13:32:08 +0800
Reviewed-on: https://cr.deepin.io/6673
Project: dde/dde-dock
Branch: refs/heads/master
4 changed files with 5 additions and 13 deletions

View File

@ -100,10 +100,7 @@ void TrashPlugin::setMode(Dock::DockMode mode)
if (mode == Dock::FashionMode)
m_proxy->itemAddedEvent(m_id);
else
{
m_itemList.clear();
m_proxy->itemRemovedEvent(m_id);
}
}
QJsonObject TrashPlugin::createMenuItem(QString itemId, QString itemName, bool checkable, bool checked)

View File

@ -46,10 +46,9 @@ signals:
void menuItemInvoked();
private:
QList<MainItem *> m_itemList;
MainItem * m_item = NULL;
QString m_id = "trash_plugin";
DockPluginProxyInterface * m_proxy;
MainItem * m_item = NULL;
Dock::DockMode m_mode = Dock::EfficientMode;

View File

@ -224,6 +224,7 @@ void Panel::onAppItemRemove(const QString &id)
if (tmpItem && tmpItem->getItemId() == id)
{
m_appLayout->removeItem(i);
tmpItem->deleteLater();
return;
}
}

View File

@ -59,7 +59,7 @@ void DockLayout::moveItem(int from, int to)
void DockLayout::removeItem(int index)
{
m_appList.takeAt(index)->deleteLater();
m_appList.removeAt(index);
relayout();
}
@ -67,7 +67,7 @@ void DockLayout::removeItem(AbstractDockItem *item)
{
int i = indexOf(item);
if (i != -1){
m_appList.takeAt(i)->deleteLater();
m_appList.removeAt(i);
relayout();
}
}
@ -152,12 +152,7 @@ void DockLayout::restoreTmpItem()
void DockLayout::clearTmpItem()
{
if (m_dragItemMap.count() > 0)
{
AbstractDockItem * tmpItem = m_dragItemMap.firstKey();
m_dragItemMap.clear();
tmpItem->deleteLater();
}
m_dragItemMap.clear();
}
void DockLayout::relayout()