Skip to content

Conversation

@wineee
Copy link
Member

@wineee wineee commented Jan 4, 2026

Summary by Sourcery

Adjust Helper configuration member ownership and access patterns.

Bug Fixes:

  • Avoid improper smart-pointer management for TreelandUserConfig by storing it as a raw pointer instead of a unique_ptr.

Enhancements:

  • Simplify access to the TreelandUserConfig instance by returning the stored pointer directly.

wineee added 2 commits January 4, 2026 14:25
Changed m_config from std::unique_ptr to raw pointer to avoid crash in
TreelandUserConfig destructor
Removed reset() calls and replaced with direct assignment
Updated config() method to return raw pointer instead of using get()

This is a temporary workaround to prevent crashes caused by
TreelandUserConfig destructor issues
The change introduces memory leaks but will be reverted once the
destructor is fixed properly

Influence:
1. Test application startup and shutdown to ensure no crashes occur
2. Verify TreelandUserConfig functionality still works correctly
3. Monitor memory usage for potential leaks during extended use
4. Test user switching functionality to ensure config updates work
properly

chore: 临时禁用 TreelandUserConfig 智能指针

将 m_config 从 std::unique_ptr 改为原始指针以避免 TreelandUserConfig 析
构函数崩溃
移除 reset() 调用并改为直接赋值
更新 config() 方法返回原始指针而非使用 get()

这是临时解决方案,用于防止 TreelandUserConfig 析构函数问题导致的崩溃
此更改会引入内存泄漏,但将在析构函数修复后撤销
@github-actions
Copy link

github-actions bot commented Jan 4, 2026

TAG Bot

TAG: 0.8.0
EXISTED: no
DISTRIBUTION: unstable

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 4, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors Helper::m_config from a std::unique_ptr-managed TreelandUserConfig to a raw pointer, updating its initialization and usage in the constructor, init() lambda, and accessor method to match the new ownership model.

File-Level Changes

Change Details Files
Refactor Helper::m_config from std::unique_ptr to raw pointer and update its initialization and accessor.
  • Change m_config member from std::unique_ptr to a raw TreelandUserConfig* with default nullptr initialization.
  • Update Helper constructor to assign m_config directly from TreelandUserConfig::createByName instead of using unique_ptr::reset.
  • Update Helper::config() to return m_config directly instead of calling get() on a std::unique_ptr.
  • Adjust the updateCurrentUser lambda in Helper::init to reassign m_config directly from TreelandUserConfig::createByName instead of using unique_ptr::reset.
src/seat/helper.h
src/seat/helper.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on 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 issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on 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 dismiss on 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 review to trigger a new review!

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Switching m_config from std::unique_ptr to a raw pointer removes clear ownership semantics and will leak the previously allocated config in updateCurrentUser; either keep std::unique_ptr or add explicit deletion logic (e.g., RAII or a smart pointer) when reassigning.
  • If m_config is now a raw pointer, ensure Helper's destructor (or an appropriate cleanup path) explicitly destroys it to avoid leaking the initial TreelandUserConfig::createByName instance created in the constructor.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Switching `m_config` from `std::unique_ptr` to a raw pointer removes clear ownership semantics and will leak the previously allocated config in `updateCurrentUser`; either keep `std::unique_ptr` or add explicit deletion logic (e.g., RAII or a smart pointer) when reassigning.
- If `m_config` is now a raw pointer, ensure `Helper`'s destructor (or an appropriate cleanup path) explicitly destroys it to avoid leaking the initial `TreelandUserConfig::createByName` instance created in the constructor.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@zccrs zccrs merged commit 00c9564 into linuxdeepin:master Jan 4, 2026
10 of 12 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wineee, zccrs

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

Details 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

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