Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#15722 closed defect (fixed)

wxCommandProcessor::IsDirty() issue when not saved and undone all commands

Reported by: neilc Owned by:
Priority: normal Milestone:
Component: GUI-all Version: dev-latest
Keywords: wxCommandProcessor IsDirty Cc:
Blocked By: Blocking:
Patch: yes

Description

Having not saved (!m_lastSavedCommand) and undone all commands (!m_currentCommand) wxCommandProcessor::IsDirty() still returns true - I'd expect this to return false since the wxCommandProcessor should be have undone back to a non-dirty state.

I've attached a patch. Note though that the initial m_commands.empty() test is now redundant - shall I create a new patch with that deleted too?

Attachments (1)

fix_cmdproc_isdirty.patch download (883 bytes) - added by neilc 13 months ago.

Download all attachments as: .zip

Change History (5)

Changed 13 months ago by neilc

comment:1 Changed 13 months ago by vadz

  • Status changed from new to confirmed

I think this patch is slightly more clear:

  • src/common/cmdproc.cpp

    diff --git a/src/common/cmdproc.cpp b/src/common/cmdproc.cpp
    index 54f14ea..b11c3ea 100644
    a b void wxCommandProcessor::ClearCommands() 
    329329 
    330330bool wxCommandProcessor::IsDirty() const 
    331331{ 
    332     if ( m_commands.empty() ) 
    333     { 
    334         // If we have never been modified, we can't be dirty. 
    335         return false; 
    336     } 
    337  
    338332    if ( !m_lastSavedCommand ) 
    339333    { 
    340334        // If we have been modified but have never been saved, we're dirty. 
    341         return true; 
     335        return m_currentCommand; 
    342336    } 
    343337 
    344338    if ( !m_currentCommand ) 

Do you see any problems with applying it?

Thanks!

comment:2 Changed 13 months ago by neilc

That patch looks good.

I'd disagree that it's clearer but that comes down to personal preference (I'd be explicit about what's being tested). I'd at least recommend updating the comment.

Thanks

comment:3 Changed 13 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [75309]) Fix wxCommandProcessor::IsDirty() for unsaved unmodified case.

IsDirty() still returned true even after undoing all the commands which was
wrong, as there was nothing to save in this case.

Closes #15722.

comment:4 Changed 13 months ago by VZ

(In [75310]) Fix wxCommandProcessor::IsDirty() for unsaved unmodified case.

IsDirty() still returned true even after undoing all the commands which was
wrong, as there was nothing to save in this case.

Closes #15722.

Note: See TracTickets for help on using tickets.