fix(device): dispatch device load notifications on GUI thread#454
Conversation
Log: 修复设备相册加载期间的跨线程计时器告警 Influence: 设备相册加载提示与文件监控计时器
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已为最佳实践,无需进一步修改
void AlbumControl::loadDeviceAlbumInfoAsync(const QString &devicePath)
{
// ...
m_PhonePicFileMap.insert(devicePath, nullptr);
QThreadPool::globalInstance()->start([=](){
// Notify QML through the GUI thread before updating the loading dialog.
QMetaObject::invokeMethod(qApp, [=](){
Q_EMIT deviceAlbumInfoLoadStart(devicePath);
}, Qt::QueuedConnection);
// ...
});
}
FileInotify::FileInotify(QObject *parent)
: QObject(parent)
{
// ...
m_timer = new QTimer(this);
connect(m_timer, &QTimer::timeout, this, &FileInotify::onNeedSendPictures);
// ...
} |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx, wyu71 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Log: 修复设备相册加载期间的跨线程计时器告警
Influence: 设备相册加载提示与文件监控计时器