[Git][wxwidgets/wxwidgets][3.2] 6 commits: Fix marking wrong item as being deleted in wxOSX wxDataViewCtrl

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Feb 5, 2026, 9:04:34 PM (11 days ago) Feb 5
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch 3.2 at wxWidgets / wxWidgets

Commits:

  • 4d0e15d8
    by Hartwig Wiesmann at 2026-02-04T23:02:12+01:00
    Fix marking wrong item as being deleted in wxOSX wxDataViewCtrl
    
    The comment in wxDataViewCtrl::IsClearing() said that the item being
    deleted should be invalid only when the entire model is being cleared,
    but this wasn't the case in ItemDeleted() as its "parent" argument could
    be invalid (e.g. when using a flat list model) even if "item" itself is
    valid.
    
    Use "item", not "parent", to set the item being deleted to the correct
    value to fix this.
    
    See #26138, #26139.
    
    (cherry picked from commit 6950c3218e4d6212f9584b124973139502cdd05b)
    
  • cf16a891
    by Vadim Zeitlin at 2026-02-04T23:02:56+01:00
    Rename wxOSXDVCDeleting::m_parent to m_item
    
    No real changes, just don't use "parent" for the name of the item being
    deleted, this is confusing as it's really the item itself and not its
    parent.
    
    See #26139.
    
    (cherry picked from commit 4bb297d962b1d23345e3b45de8006d7a015e34ea)
    
  • 81ebf59a
    by Vadim Zeitlin at 2026-02-04T23:03:23+01:00
    Document wxGetStockHelpString() function
    
    It was added back in 345319d60c (fixes to menu stock items support
    (patch 1547639), 2006-09-05) and even if it's not particularly useful,
    it still should be documented, so add documentation for it.
    
    See #8090.
    
    (cherry picked from commit e80d78c2c96a4986c32a33f83d0118c2397836fb)
    
  • 14c2b46b
    by Vadim Zeitlin at 2026-02-04T23:03:30+01:00
    Minor corrections to standard IDs documentation
    
    Remove misleading Doxygen comments copied from the comments in C++
    header which didn't make sense here.
    
    Improve the documentation of menu ID ranges.
    
    (cherry picked from commit 5a95c14a39e13cd3fe713a278efe957b5ab13ac5)
    
  • 0910d8fa
    by Stefan Csomor at 2026-02-06T02:49:51+01:00
    Fix crash on key press in wxDataViewCtrl in wxOSX
    
    Don't access out of bounds NSString characters when processing key
    events, as this results in an exception and crash under current macOS
    versions.
    
    See #26160, #26161.
    
    (cherry picked from commit fe038044c4f1a05717a0bdc440359fb315b5f61f)
    
  • dd7a3da5
    by Vadim Zeitlin at 2026-02-06T02:56:32+01:00
    Fix using invalid filter index in wxOSX wxFileDialog
    
    Ensure we use the valid index in m_filterExtensions when
    m_firstFileTypeFilter was set to -1.
    
    This is the equivalent of 17dbee8a46 (Fix using invalid filter index in
    wxOSX wxFileDialog, 2026-02-04) from master, but applied to both copies
    of the code present in this branch.
    
    See #26148.
    

6 changed files:

Changes:

  • docs/changes.txt
    ... ... @@ -268,6 +268,9 @@ wxMSW:
    268 268
     
    
    269 269
     wxOSX:
    
    270 270
     
    
    271
    +- Fix bug when deleting wxDataViewCtrl items (Hartwig Wiesmann, #26138).
    
    272
    +- Fix crash on some key presses in wxDataViewCtrl (#26160).
    
    273
    +- Fix regression in wxFileDialog filters in 3.2.9 (#26148).
    
    271 274
     - Improve wxRichTextCtrl handling of cursor keys (Lee Ockert, #26064).
    
    272 275
     - Many appearance fixes for macOS 26 Tahoe (#26058, #25767, #26121).
    
    273 276
     - Show applications launched from keyboard under macOS 26 (#26095).
    

  • interface/wx/defs.h
    ... ... @@ -660,7 +660,7 @@ enum wxStandardID
    660 660
         wxID_FILE8,
    
    661 661
         wxID_FILE9,
    
    662 662
     
    
    663
    -    /** Standard button and menu IDs */
    
    663
    +    // Standard button and menu IDs
    
    664 664
         wxID_OK = 5100,
    
    665 665
         wxID_CANCEL,
    
    666 666
         wxID_APPLY,
    
    ... ... @@ -723,16 +723,15 @@ enum wxStandardID
    723 723
         wxID_SPELL_CHECK,
    
    724 724
         wxID_STRIKETHROUGH,
    
    725 725
     
    
    726
    -    /** System menu IDs (used by wxUniv): */
    
    727
    -    wxID_SYSTEM_MENU = 5200,
    
    728
    -    wxID_CLOSE_FRAME,
    
    729
    -    wxID_MOVE_FRAME,
    
    730
    -    wxID_RESIZE_FRAME,
    
    731
    -    wxID_MAXIMIZE_FRAME,
    
    732
    -    wxID_ICONIZE_FRAME,
    
    733
    -    wxID_RESTORE_FRAME,
    
    726
    +    wxID_SYSTEM_MENU = 5200,///< System menu ID (used only by wxUniv).
    
    727
    +    wxID_CLOSE_FRAME,       ///< System menu close item ID (used only by wxUniv).
    
    728
    +    wxID_MOVE_FRAME,        ///< System menu move item ID (used only by wxUniv).
    
    729
    +    wxID_RESIZE_FRAME,      ///< System menu size item ID (used only by wxUniv).
    
    730
    +    wxID_MAXIMIZE_FRAME,    ///< System menu maximize item ID (used only by wxUniv).
    
    731
    +    wxID_ICONIZE_FRAME,     ///< System menu minimize item ID (used only by wxUniv).
    
    732
    +    wxID_RESTORE_FRAME,     ///< System menu restore item ID (used only by wxUniv).
    
    734 733
     
    
    735
    -    /** MDI window menu ids */
    
    734
    +    /// Start of the range of IDs reserved for MDI menu commands.
    
    736 735
         wxID_MDI_WINDOW_FIRST = 5230,
    
    737 736
         wxID_MDI_WINDOW_CASCADE = wxID_MDI_WINDOW_FIRST,
    
    738 737
         wxID_MDI_WINDOW_TILE_HORZ,
    
    ... ... @@ -740,12 +739,13 @@ enum wxStandardID
    740 739
         wxID_MDI_WINDOW_ARRANGE_ICONS,
    
    741 740
         wxID_MDI_WINDOW_PREV,
    
    742 741
         wxID_MDI_WINDOW_NEXT,
    
    742
    +    /// End of the range of IDs reserved for MDI menu commands.
    
    743 743
         wxID_MDI_WINDOW_LAST = wxID_MDI_WINDOW_NEXT,
    
    744 744
     
    
    745
    -    /** IDs used by generic file dialog (13 consecutive starting from this value) */
    
    745
    +    /** Start of IDs used by generic file dialog (13 consecutive starting from this value) */
    
    746 746
         wxID_FILEDLGG = 5900,
    
    747 747
     
    
    748
    -    /** IDs used by generic file ctrl (4 consecutive starting from this value) */
    
    748
    +    /** Start of IDs used by generic file control (4 consecutive starting from this value) */
    
    749 749
         wxID_FILECTRL = 5950,
    
    750 750
     
    
    751 751
         /**
    

  • interface/wx/stockitem.h
    ... ... @@ -81,3 +81,30 @@ wxString wxGetStockLabel(wxWindowID id, long flags = wxSTOCK_WITH_MNEMONIC);
    81 81
     
    
    82 82
     ///@}
    
    83 83
     
    
    84
    +/** @addtogroup group_funcmacro_misc */
    
    85
    +///@{
    
    86
    +
    
    87
    +/**
    
    88
    +    Return help string associated with given stock @a id and @a client.
    
    89
    +
    
    90
    +    This function uses the default help string shown in the status bar when the
    
    91
    +    item with the given @a id is selected in a menu, e.g. for ::wxID_EXIT the
    
    92
    +    returned string is "Quit this program".
    
    93
    +
    
    94
    +    @param id
    
    95
    +        The stock item identifier to get the help string for.
    
    96
    +    @param client
    
    97
    +        The client context for which the help string is requested, currently
    
    98
    +        can only be `wxSTOCK_MENU`, which is the default value for this
    
    99
    +        parameter.
    
    100
    +    @return
    
    101
    +        The translated help string for the given stock item identifier and
    
    102
    +        client context, or an empty string if no default help string is
    
    103
    +        available for this @a id.
    
    104
    +
    
    105
    +    @header{wx/stockitem.h}
    
    106
    + */
    
    107
    +wxString wxGetStockHelpString(wxWindowID id,
    
    108
    +                              wxStockHelpStringClient client = wxSTOCK_MENU);
    
    109
    +
    
    110
    +///@}

  • src/osx/cocoa/dataview.mm
    ... ... @@ -2035,8 +2035,8 @@ wxCocoaDataViewControl::~wxCocoaDataViewControl()
    2035 2035
     
    
    2036 2036
     void wxCocoaDataViewControl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
    
    2037 2037
     {
    
    2038
    -    if( [event type] == NSKeyDown && [[event charactersIgnoringModifiers]
    
    2039
    -         characterAtIndex: 0] == NSCarriageReturnCharacter )
    
    2038
    +    NSString* c = [event type] == NSKeyDown ? [event charactersIgnoringModifiers] : nil;
    
    2039
    +    if( c != nil && [c length] >= 1 && [c characterAtIndex: 0] == NSCarriageReturnCharacter )
    
    2040 2040
         {
    
    2041 2041
             wxDataViewCtrl* const dvc = GetDataViewCtrl();
    
    2042 2042
             const wxDataViewItem item = wxDataViewItem( [[m_OutlineView itemAtRow:[m_OutlineView selectedRow]] pointer]);
    

  • src/osx/cocoa/filedlg.mm
    ... ... @@ -320,7 +320,11 @@ void wxFileDialog::ShowWindowModal()
    320 320
             }
    
    321 321
             else
    
    322 322
             {
    
    323
    -            NSArray* types = GetTypesFromExtension(m_filterExtensions[m_firstFileTypeFilter], m_currentExtensions);
    
    323
    +            // m_firstFileTypeFilter may be -1 here if we're not using the
    
    324
    +            // combobox for selecting the filter, use the first filter in this
    
    325
    +            // case
    
    326
    +            const int filterIndex = m_useFileTypeFilter ? m_firstFileTypeFilter : 0;
    
    327
    +            NSArray* types = GetTypesFromExtension(m_filterExtensions[filterIndex], m_currentExtensions);
    
    324 328
                 if ( m_delegate )
    
    325 329
                     [(wxOpenSavePanelDelegate*) m_delegate setAllowedExtensions: m_currentExtensions];
    
    326 330
                 else
    
    ... ... @@ -646,7 +650,11 @@ int wxFileDialog::ShowModal()
    646 650
             }
    
    647 651
             else
    
    648 652
             {
    
    649
    -            NSArray* types = GetTypesFromExtension(m_filterExtensions[m_firstFileTypeFilter], m_currentExtensions);
    
    653
    +            // m_firstFileTypeFilter may be -1 here if we're not using the
    
    654
    +            // combobox for selecting the filter, use the first filter in this
    
    655
    +            // case
    
    656
    +            const int filterIndex = m_useFileTypeFilter ? m_firstFileTypeFilter : 0;
    
    657
    +            NSArray* types = GetTypesFromExtension(m_filterExtensions[filterIndex], m_currentExtensions);
    
    650 658
                 if ( m_delegate )
    
    651 659
                     [(wxOpenSavePanelDelegate*) m_delegate setAllowedExtensions: m_currentExtensions];
    
    652 660
                 else
    

  • src/osx/dataview_osx.cpp
    ... ... @@ -55,11 +55,11 @@ wxString ConcatenateDataViewItemValues(wxDataViewCtrl const* dataViewCtrlPtr, wx
    55 55
     
    
    56 56
     struct wxOSXDVCDeleting
    
    57 57
     {
    
    58
    -    explicit wxOSXDVCDeleting(const wxDataViewItem& parent) : m_parent(parent)
    
    58
    +    explicit wxOSXDVCDeleting(const wxDataViewItem& item) : m_item(item)
    
    59 59
         {
    
    60 60
         }
    
    61 61
     
    
    62
    -    const wxDataViewItem m_parent;
    
    62
    +    const wxDataViewItem m_item;
    
    63 63
     
    
    64 64
         wxDECLARE_NO_COPY_CLASS(wxOSXDVCDeleting);
    
    65 65
     };
    
    ... ... @@ -68,11 +68,11 @@ struct wxOSXDVCDeleting
    68 68
     class wxOSXDVCScopedDeleter
    
    69 69
     {
    
    70 70
     public:
    
    71
    -    wxOSXDVCScopedDeleter(wxDataViewCtrl* dvc, const wxDataViewItem& parent) :
    
    71
    +    wxOSXDVCScopedDeleter(wxDataViewCtrl* dvc, const wxDataViewItem& item) :
    
    72 72
             m_dvc(dvc),
    
    73 73
             m_valueOrig(m_dvc->m_Deleting)
    
    74 74
         {
    
    75
    -        m_dvc->m_Deleting = new wxOSXDVCDeleting(parent);
    
    75
    +        m_dvc->m_Deleting = new wxOSXDVCDeleting(item);
    
    76 76
         }
    
    77 77
     
    
    78 78
         ~wxOSXDVCScopedDeleter()
    
    ... ... @@ -236,7 +236,7 @@ bool wxOSXDataViewModelNotifier::ItemDeleted(wxDataViewItem const& parent, wxDat
    236 236
      // not to be identical because the being edited item might be below the passed item in the hierarchy);
    
    237 237
      // to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
    
    238 238
      // has been started and that variables can currently not be updated even when requested by the system:
    
    239
    -  wxOSXDVCScopedDeleter setDeleting(m_DataViewCtrlPtr, parent);
    
    239
    +  wxOSXDVCScopedDeleter setDeleting(m_DataViewCtrlPtr, item);
    
    240 240
     
    
    241 241
       bool ok = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent);
    
    242 242
     
    
    ... ... @@ -429,7 +429,7 @@ bool wxDataViewCtrl::IsClearing() const
    429 429
     {
    
    430 430
         // We only set the item being deleted to an invalid item when we're
    
    431 431
         // clearing the entire model.
    
    432
    -    return m_Deleting != NULL && !m_Deleting->m_parent.IsOk();
    
    432
    +    return m_Deleting != NULL && !m_Deleting->m_item.IsOk();
    
    433 433
     }
    
    434 434
     
    
    435 435
     bool wxDataViewCtrl::Create(wxWindow *parent,
    

Reply all
Reply to author
Forward
0 new messages