Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#14624 closed defect (outdated)

Fix for issue in ribbon bar show pages

Reported by: wxBen Owned by:
Priority: normal Milestone:
Component: GUI-all Version: stable-latest
Keywords: ribbon bar page show hide tabs Cc:
Blocked By: Blocking:
Patch: yes

Description

The code is building a sorted array of pages and then looping over them. The second loop skips over pages not shown. However, the code that was building the sorted array was also skipping over pages not shown, yet the loop immediately afterwards assumes that all pages are in the sorted list and it then also skips over pages not shown.

Inspection of the code below shows that the two lines

                    if (!m_pages.Item(i).shown)
                        continue;

should be removed for it to function as intended. Otherwise the list so sorted pages can have fewer entries than numtabs and the second loop will crash or fail.

                wxRibbonPageTabInfoArray sorted_pages;
                for(i = 0; i < numtabs; ++i)
                {
                    // Sneaky obj array trickery to not copy the tab descriptors
                    if (!m_pages.Item(i).shown)
                        continue;
                    sorted_pages.Add(&m_pages.Item(i));
                }
                sorted_pages.Sort(OrderPageTabInfoBySmallWidthAsc);
                width -= tabsep * (numtabs - 1);
                for(i = 0; i < numtabs; ++i)
                {
                    wxRibbonPageTabInfo& info = sorted_pages.Item(i);
                    if (!info.shown)
                        continue;

Attachments (1)

ShownPagesFix.patch download (598 bytes) - added by wxBen 9 years ago.
ShownPagesFix.patch

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by wxBen

ShownPagesFix.patch

comment:1 Changed 9 years ago by wxBen

  • Resolution set to outdated
  • Status changed from new to closed

comment:2 Changed 9 years ago by wxBen

This is being replaced by a patch with another fix in teh same code.

Note: See TracTickets for help on using tickets.