Sfoglia il codice sorgente

LibGUI: Don't call on_segment_change handler if the index did not change

This patch makes the handler's behavior closer to what can be expected
from it's name by not handling set_selected_segment if the segment is
already selected.
networkException 2 anni fa
parent
commit
c1c11df3b8
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      Userland/Libraries/LibGUI/Breadcrumbbar.cpp

+ 2 - 0
Userland/Libraries/LibGUI/Breadcrumbbar.cpp

@@ -136,6 +136,8 @@ Optional<size_t> Breadcrumbbar::find_segment_with_data(String const& data)
 
 void Breadcrumbbar::set_selected_segment(Optional<size_t> index)
 {
+    if (m_selected_segment == index)
+        return;
     m_selected_segment = index;
 
     if (!index.has_value()) {