dde-calendar
dde-calendar copied to clipboard
fix: 修复重复删除相同日程数据崩溃问题
修复重复删除相同日程数据崩溃问题 Bug: https://pms.uniontech.com/bug-view-303095.html Log: 修复重复删除相同日程数据崩溃问题
Summary by Sourcery
Bug Fixes:
- Prevent application crash when attempting to delete the same schedule item multiple times by adding visibility checks and modifying the delete method to return a boolean status
Reviewer's Guide by Sourcery
This pull request fixes a crash that occurs when attempting to delete the same schedule data multiple times. The fix ensures that a schedule item is only deleted once by checking its visibility before allowing deletion and hiding the item after a successful deletion.
Sequence diagram for deleting a schedule item
sequenceDiagram
participant User
participant DragInfoGraphicsView
participant DragInfoItem
participant CScheduleOperation
User->>DragInfoGraphicsView: Right-clicks on schedule item
DragInfoGraphicsView->>DragInfoItem: infoitem = dynamic_cast(item)
alt infoitem != nullptr && infoitem->isVisible()
DragInfoGraphicsView->>DragInfoGraphicsView: DeleteItem(infoitem->getData())
DragInfoGraphicsView->>CScheduleOperation: _scheduleOperation.deleteSchedule(info)
CScheduleOperation-->>DragInfoGraphicsView: return success
DragInfoGraphicsView->>DragInfoItem: infoitem->setVisible(false)
else infoitem == nullptr || !infoitem->isVisible()
DragInfoGraphicsView-->>User: No action
end
Updated class diagram for DragInfoGraphicsView
classDiagram
class DragInfoGraphicsView {
-QMenu* m_rightMenu
-QAction* m_deleteAction
+DeleteItem(DSchedule::Ptr info) bool
+contextMenuEvent(QContextMenuEvent *event)
+slotContextMenu(CFocusItem *item)
}
DragInfoGraphicsView -- CScheduleOperation : Uses
DragInfoGraphicsView -- DragInfoItem : Uses
class CScheduleOperation {
+deleteSchedule(DSchedule::Ptr info) bool
+isFestival(DSchedule::Ptr info) bool
}
class DragInfoItem {
+setVisible(bool visible)
+getData() DSchedule::Ptr
+isVisible() bool
}
note for DragInfoGraphicsView "DeleteItem now returns a boolean indicating success."
note for DragInfoItem "Added isVisible() method."
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Added a visibility check before deleting a schedule item and hiding the item after deletion to prevent multiple deletions of the same data. |
|
calendar-client/src/view/draginfographicsview.cppcalendar-client/src/view/draginfographicsview.h |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review! - Generate a plan of action for an issue: Comment
@sourcery-ai planon an issue to generate a plan of action for it.
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: lzwind, myk1343
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/forcemerge
This pr force merged! (status: unstable)