dde-dock/frame/util/menuworker.h
wubowen 1c57108dc1 fix: update daemonDockInterface when the dde-daemon dock interface init after dde-dock
当dock比dde-daemon的dockInterface启动更早,dock会delete该interface指针后重新new
但是在menuworker里面,还是使用的未更新的dockInterface对象,即野指针
因此会导致调用接口后崩溃

Log: Update daemonDockInterface when daemon init behind dock
Influence: 注销右键点击出现菜单栏
Bug: https://pms.uniontech.com/bug-view-155357.html
Change-Id: I666c3e66f3bfbdbd66c230d8d5ea72175b355289
2022-08-26 15:00:03 +08:00

62 lines
1.6 KiB
C++

/*
* Copyright (C) 2018 ~ 2020 Deepin Technology Co., Ltd.
*
* Author: fanpengcheng <fanpengcheng_cm@deepin.com>
*
* Maintainer: fanpengcheng <fanpengcheng_cm@deepin.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MENUWORKER_H
#define MENUWORKER_H
#include <QObject>
#include "constants.h"
#include <com_deepin_dde_daemon_dock.h>
using DBusDock = com::deepin::dde::daemon::Dock;
class QMenu;
class QGSettings;
/**
* @brief The MenuWorker class 此类用于处理任务栏右键菜单的逻辑
*/
class MenuWorker : public QObject
{
Q_OBJECT
public:
explicit MenuWorker(DBusDock *dockInter,QWidget *parent = nullptr);
void showDockSettingsMenu(QMenu *menu);
signals:
void autoHideChanged(const bool autoHide) const;
public slots:
void setAutoHide(const bool autoHide);
void onNotifyDaemonInterfaceUpdate(DBusDock *dockInter);
private:
QMenu *createMenu(QMenu *settingsMenu);
private slots:
void onDockSettingsTriggered();
private:
DBusDock *m_dockInter;
bool m_autoHide;
};
#endif // MENUWORKER_H