Skip to content
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

fix: DMessageManager::sendMessage cause crash #584

Merged
merged 1 commit into from
Jul 1, 2024
Merged

fix: DMessageManager::sendMessage cause crash #584

merged 1 commit into from
Jul 1, 2024

Conversation

zty199
Copy link
Contributor

@zty199 zty199 commented Jun 25, 2024

when compiled with Qt6, in sendMessage_helper, seems that content could be nullptr when QWebEngineView is DMainWindow's centralWidget

Log: add judgment whether content is nullptr in sendMessage_helper

deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Jun 25, 2024
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#584
@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jun 27, 2024

TAG Bot

New tag: 5.6.31
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #583

deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Jul 1, 2024
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#584
Copy link
Contributor

@kegechen kegechen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标题太长了,简化一下

in sendMessage_helper, seems that content could be nullptr when QWebEngineView is DMainWindow's centralWidget

Log: add judgment whether content is nullptr in sendMessage_helper
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

关键摘要:

  • 代码中使用了findChildren<T>方法来查找子对象,但没有检查content是否为nullptr,可能会导致空指针解引用。
  • 在循环中,text_message_count的初始化应该放在循环内部,以避免在每次迭代时都进行重复的计数。
  • 循环中没有对message进行任何操作,如果只是为了计数,可以考虑直接使用findChildren而不需要创建临时对象。
  • 新增的注释// TransientType 类型的通知消息,最多只允许同时显示三个应该放在循环外部,以便于理解代码的意图。

是否建议立即修改:

deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Jul 1, 2024
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#584
@zty199 zty199 changed the title fix: DMessageManager::sendMessage cause crash when QWebEngineView is DMainWindow's centralWidget fix: DMessageManager::sendMessage cause crash Jul 1, 2024
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kegechen, zty199

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kegechen kegechen merged commit bed8dbf into linuxdeepin:master Jul 1, 2024
19 of 21 checks passed
@zty199 zty199 deleted the fix/dmessagemanager branch July 1, 2024 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants