mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 调用野指针导致崩溃
拖动图标移除后,原来的item已经被析构了,这里指针就变成了野指针。 Log: 修复任务栏拖动图标导致崩溃的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-62246.html Change-Id: I852ad6413a1d6b260723148b73bcab7f91f3ce47
This commit is contained in:
parent
81053b31c9
commit
7a0d7332ae
@ -677,8 +677,9 @@ void MainPanelControl::mousePressEvent(QMouseEvent *e)
|
|||||||
QWidget::mousePressEvent(e);
|
QWidget::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainPanelControl::startDrag(DockItem *item)
|
void MainPanelControl::startDrag(DockItem *dockItem)
|
||||||
{
|
{
|
||||||
|
QPointer<DockItem> item = dockItem;
|
||||||
const QPixmap pixmap = item->grab();
|
const QPixmap pixmap = item->grab();
|
||||||
|
|
||||||
item->setDraging(true);
|
item->setDraging(true);
|
||||||
@ -692,7 +693,7 @@ void MainPanelControl::startDrag(DockItem *item)
|
|||||||
|
|
||||||
connect(m_appDragWidget, &AppDragWidget::destroyed, this, [ = ] {
|
connect(m_appDragWidget, &AppDragWidget::destroyed, this, [ = ] {
|
||||||
m_appDragWidget = nullptr;
|
m_appDragWidget = nullptr;
|
||||||
if (qobject_cast<AppItem *>(item)->isValid()) {
|
if (!item.isNull() && qobject_cast<AppItem *>(item)->isValid()) {
|
||||||
if (-1 == m_appAreaSonLayout->indexOf(item) && m_dragIndex != -1) {
|
if (-1 == m_appAreaSonLayout->indexOf(item) && m_dragIndex != -1) {
|
||||||
insertItem(m_dragIndex, item);
|
insertItem(m_dragIndex, item);
|
||||||
m_dragIndex = -1;
|
m_dragIndex = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user