Skip to content

Commit 94b77c7

Browse files
committed
fix: fix plugin loading order and state synchronization
1. Move loadPlugin() call earlier in init() to ensure plugin is loaded before other initialization steps when not disabled 2. Reorder itemAdded() call to happen before setting m_pluginLoaded to true in loadPlugin() 3. Fix logging statement to use correct variable m_shouldShow instead of shouldShow 4. This ensures proper initialization sequence and prevents potential race conditions Log: Fixed plugin loading order and state synchronization issues Influence: 1. Test plugin initialization when enabled/disabled 2. Verify update icon appears correctly in dock 3. Check plugin state transitions during system updates 4. Test plugin behavior after display mode changes 5. Verify logging shows correct plugin visibility state fix: 修复插件加载顺序和状态同步问题 1. 将 loadPlugin() 调用移到 init() 函数更早位置,确保插件在未禁用时在其 他初始化步骤之前加载 2. 重新排序 itemAdded() 调用,使其在设置 m_pluginLoaded 为 true 之前执行 3. 修复日志语句,使用正确的变量 m_shouldShow 而不是 shouldShow 4. 确保正确的初始化顺序,防止潜在的竞态条件 Log: 修复插件加载顺序和状态同步问题 Influence: 1. 测试插件在启用/禁用时的初始化 2. 验证更新图标在任务栏中正确显示 3. 检查系统更新期间的插件状态转换 4. 测试显示模式更改后的插件行为 5. 验证日志显示正确的插件可见性状态 PMS: BUG-345425
1 parent f944808 commit 94b77c7

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/dock-update-plugin/pluginupdateplugin.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ QWidget *PluginUpdatePlugin::itemTipsWidget(const QString &itemKey)
9191
void PluginUpdatePlugin::init(PluginProxyInterface *proxyInter)
9292
{
9393
m_proxyInter = proxyInter;
94+
if (!pluginIsDisable()) {
95+
loadPlugin();
96+
}
9497
if (!m_dconfig) {
9598
qCWarning(dockUpdatePlugin) << "Failed to create DConfig for org.deepin.dde.lastore";
9699
return;
@@ -108,9 +111,6 @@ void PluginUpdatePlugin::init(PluginProxyInterface *proxyInter)
108111
updateDockHiddenSurfaceIds(true);
109112

110113
updateStateFromUpdateStatus();
111-
if (!pluginIsDisable()) {
112-
loadPlugin();
113-
}
114114
}
115115

116116
void PluginUpdatePlugin::pluginStateSwitched()
@@ -227,14 +227,13 @@ void PluginUpdatePlugin::loadPlugin()
227227
if (m_pluginLoaded) {
228228
return;
229229
}
230-
230+
m_proxyInter->itemAdded(this, UPDATE_STATE_KEY);
231231
m_pluginLoaded = true;
232232

233233
m_dockIcon.reset(new DockIconWidget);
234234
m_dockIcon->setFixedSize(Dock::DOCK_PLUGIN_ITEM_FIXED_SIZE);
235235

236236
updateIconState();
237-
m_proxyInter->itemAdded(this, UPDATE_STATE_KEY);
238237
displayModeChanged(displayMode());
239238
}
240239

@@ -347,7 +346,7 @@ void PluginUpdatePlugin::updateStateFromUpdateStatus()
347346
updateIconState();
348347
}
349348

350-
qCInfo(dockUpdatePlugin) << "Plugin should show:" << shouldShow;
349+
qCInfo(dockUpdatePlugin) << "Plugin should show:" << m_shouldShow;
351350
return;
352351
}
353352

0 commit comments

Comments
 (0)