mgradwohl / mgradwohl/Butternut

bRet will always be true

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

AnkerConfigDialog

        bool AnkerConfigDlg::handleDirtyPreset() {
            // According to product requirements, when the parameter details dialog box is closed, 
                   // if the preset configuration has been modified, a save preset pop - up window needs to be displayed.
            **bool bRet = true;**
            unsigned int selectedIndex = m_lastSelectPreset->GetSelection();
            std::string preset_name = m_lastSelectPreset->GetString(selectedIndex).ToUTF8().data();
            Preset::Type presetType = m_lastSelectPreset->type();
            bool bCurIsDirty = wxGetApp().getAnkerTab(presetType)->current_preset_is_dirty();
            ANKER_LOG_INFO << "handleDirtyPreset enter, bCurIsDirty:" << bCurIsDirty << ",preset_name is " << preset_name.c_str()
                << ",presetType:" << presetType;
            if (bCurIsDirty) {
                //wxGetApp().getAnkerTab(presetType)->select_preset(Preset::remove_suffix_modified(preset_name));
                return wxGetApp().getAnkerTab(presetType)->AnkerMayDiscardCurDirtyPreset(nullptr,
                    Preset::remove_suffix_modified(preset_name));
            }
            **return bRet;**
        }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to AnkerConfigDlg::handleDirtyPreset in AnkerConfigDialog. Read the dirty-preset branch and its callers to determine the intended return value when no dirty preset exists, then compare it with the stated save-preset requirement. Done means the function's return behavior matches that dialog flow rather than reporting an unconditional result.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.