https://bugs.kde.org/show_bug.cgi?id=524848

            Bug ID: 524848
           Summary: Reshowing the same QMessageBox duplicates its buttons
                    and fires clicked twice
    Classification: Plasma
           Product: plasma-integration
      Version First 6.7.4
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Since 6c7be886 ("MessageDialogHelper: don't set WA_DeleteOnClose", in 6.7.5)
the helper
holds one QMessageBox for its whole life, but show() still builds it up from
scratch on
every call. QDialogPrivate caches the helper, so if an app opens the same
dialog object a
second time, the second setup is piled on top of the first.

Steps: build the attached one-file test and run QT_QPA_PLATFORMTHEME=kde
./reshow
  g++ -std=c++17 -fPIC main.cpp -o reshow $(pkg-config --cflags --libs
Qt6Widgets)
It keeps one QMessageBox with two custom buttons plus Ok/Cancel and opens it
three times.

Observed:  show #1 - 4 buttons, one press gives 1 buttonClicked
           show #2 - 8 buttons, one press gives 2
           show #3 - 12 buttons, one press gives 3   (screenshot attached)
Expected:  4 buttons every time, one press gives one buttonClicked.

show() runs the addButton() loops and connect(m_box,
&QMessageBox::buttonClicked, ...)
unconditionally; nothing clears the box or drops the old connection.
m_customButtonIds
grows too.

I built the plugin at 6c7be886^ and at 6c7be886 on the same machine: the parent
is clean
in all three rounds, the commit itself shows the growth. Also reproduces on
Arch's
plasma-integration 6.7.4-5.1, which already carries the patch. Qt 6.11.2,
Plasma Wayland.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to