-
Notifications
You must be signed in to change notification settings - Fork 15
sync: from linuxdeepin/dtkcore #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
05250a0 to
4833e32
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
4833e32 to
8366a1c
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
8366a1c to
0d8c3d6
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
0d8c3d6 to
847e158
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
847e158 to
81a530e
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot 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 |
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
81a530e to
b02a3f0
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
b02a3f0 to
9cb61b0
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
9cb61b0 to
df42b25
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
df42b25 to
daab7f2
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
daab7f2 to
6298f29
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
6298f29 to
6662bdf
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
6662bdf to
0e09405
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
0e09405 to
970cfdf
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
970cfdf to
e263fd7
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
e263fd7 to
e20259c
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
e20259c to
ecd8569
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
ecd8569 to
e4c6c2e
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
e4c6c2e to
706e843
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
Synchronize source files from linuxdeepin/dtkcore. Source-pull-request: linuxdeepin/dtkcore#531
706e843 to
cbb19b7
Compare
deepin pr auto review代码审查报告1. 整体评估本次代码变更主要是对DTK(Deepin Tool Kit)核心模块的重构,主要涉及版本管理、配置系统和工具链的改进。整体来看,代码结构更加清晰,线程安全性有所增强,但存在一些可以改进的地方。 2. 语法和逻辑问题2.1 版本管理逻辑在 option(DTK5 "Build DTK5." ON)
if(DTK5)
set(DTK_VERSION_MAJOR "5")
set(DTK_NAME_SUFFIX "") # Empty name suffix for DTK5 products.
else()
set(DTK_VERSION_MAJOR "6")
set(DTK_NAME_SUFFIX "6")
endif()问题:版本判断逻辑不够清晰,缺少对其他版本的支持。 建议:
2.2 配置文件生成在 headerStream << "#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)\n"
<< "#include <QProperty>\n"
<< "#endif\n";
headerStream << "#include <QEvent>\n";问题:条件编译的顺序可能导致某些情况下头文件包含顺序不正确。 建议:将公共头文件放在条件编译之前。 3. 代码质量问题3.1 命名一致性在多个文件中存在命名不一致的问题:
建议:
3.2 代码重复在 inline void updateProperty(const QString &key, const QVariant &v) {
if (key == QStringLiteral("autoDisplayFeature")) {
// ... 大量重复代码
}
// ... 更多重复代码
}建议:
4. 性能问题4.1 原子操作使用在多个文件中频繁使用原子操作: QAtomicPointer<DTK_CORE_NAMESPACE::DConfig> m_config = nullptr;
QAtomicInteger<int> m_status = static_cast<int>(Data::Status::Invalid);问题:过度使用原子操作可能导致不必要的性能开销。 建议:
4.2 字符串处理在 QString p_key3 { QStringLiteral(u"\u0067\u006c\u006f\u0062\u0061\u006c") };问题:使用Unicode转义序列可能导致不必要的性能开销。 建议:直接使用普通字符串字面量,除非有特殊需求。 5. 安全性问题5.1 线程安全在 QMetaObject::invokeMethod(worker, [safeData, backend, name, appId, subpath, isGeneric, worker]() mutable {
delete worker;
worker = nullptr;
// ...
});问题:lambda中使用 建议:
5.2 内存管理在多个文件中存在复杂的内存管理逻辑: ~dconfig_org_deepin_dtk_preference() {
int oldStatus = m_data->m_status.fetchAndStoreOrdered(static_cast<int>(Data::Status::Destroyed));
m_data->m_userConfig = nullptr;
if (oldStatus == static_cast<int>(Data::Status::Succeeded)) {
auto config = m_data->m_config.loadRelaxed();
Q_ASSERT(config);
config->deleteLater();
// m_data will be deleted by config's destroyed signal
} else if (oldStatus == static_cast<int>(Data::Status::Failed) ||
oldStatus == static_cast<int>(Data::Status::Invalid)) {
m_data->deleteLater();
}
}问题:复杂的析构逻辑可能导致内存泄漏或双重释放。 建议:
6. 改进建议6.1 版本管理# 改进后的版本管理
set(DTK_SUPPORTED_VERSIONS "5;6")
set(DTK_DEFAULT_VERSION "5")
set(DTK_VERSION "${DTK_DEFAULT_VERSION}" CACHE STRING "DTK version to build")
set_property(CACHE DTK_VERSION PROPERTY STRINGS ${DTK_SUPPORTED_VERSIONS})
if(NOT DTK_VERSION IN_LIST DTK_SUPPORTED_VERSIONS)
message(FATAL_ERROR "Unsupported DTK version: ${DTK_VERSION}. Supported versions: ${DTK_SUPPORTED_VERSIONS}")
endif()
if(DTK_VERSION STREQUAL "5")
set(DTK_NAME_SUFFIX "")
else()
set(DTK_NAME_SUFFIX "${DTK_VERSION}")
endif()6.2 线程安全改进// 改进后的线程安全实现
class DConfigHolder {
public:
DConfigHolder() = default;
~DConfigHolder() {
QWriteLocker locker(&m_lock);
m_config.reset();
}
void setConfig(DTK_CORE_NAMESPACE::DConfig* config) {
QWriteLocker locker(&m_lock);
m_config.reset(config);
}
DTK_CORE_NAMESPACE::DConfig* config() const {
QReadLocker locker(&m_lock);
return m_config.get();
}
private:
mutable QReadWriteLock m_lock;
QScopedPointer<DTK_CORE_NAMESPACE::DConfig> m_config;
};6.3 内存管理改进// 使用智能指针改进内存管理
class dconfig_org_deepin_dtk_preference : public QObject {
Q_OBJECT
public:
explicit dconfig_org_deepin_dtk_preference(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend,
const QString &name, const QString &appId, const QString &subpath,
bool isGeneric, QObject *parent)
: QObject(parent)
, m_data(std::make_unique<Data>(this)) {
// ...
}
~dconfig_org_deepin_dtk_preference() {
// 简化的析构逻辑
if (m_data) {
m_data->cleanup();
}
}
private:
std::unique_ptr<Data> m_data;
};7. 总结本次代码变更在版本管理和线程安全性方面有所改进,但仍存在以下主要问题:
建议优先解决线程安全和内存管理问题,然后逐步重构代码以减少重复。同时,考虑引入更现代的C++特性(如智能指针)来简化资源管理。 |
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
Synchronize source files from linuxdeepin/dtkcore.
Source-pull-request: linuxdeepin/dtkcore#531