Bug 443679

Summary: Exiting color change popup via "Cancel" modifies the selected diagram object
Product: [Applications] umbrello Reporter: Oliver Kellogg <okellogg>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 2.33.80 (KDE releases 22.03.80)
Sentry Crash Report:

Description Oliver Kellogg 2021-10-13 20:34:20 UTC
SUMMARY

Exiting color change popup via "Cancel" modifies the selected diagram object.

STEPS TO REPRODUCE

1. Start Umbrello, create or load a class in the class diagram.
2. In the class diagram right click on class and select Color -
   Line Color or Fill Color.
3. In the color selection dialog that pops up, press Cancel.

OBSERVED RESULT

The selected item color will change to black.
In the case of Fill Color this is quite bad - the whole class will turn black.

EXPECTED RESULT

When exiting the color popup via Cancel, nothing shall change.

SOFTWARE/OS VERSIONS
Linux: openSuSE Tumbleweed 20210902
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Umbrello version: Git master commit 50ef037 (2021-09-18)
Comment 1 Oliver Kellogg 2021-10-13 20:53:23 UTC
Git commit eac23da83da18c4f966e4a01b948be7404156123 by Oliver Kellogg.
Committed on 13/10/2021 at 20:52.
Pushed by okellogg into branch 'master'.

Fix "Exiting color change popup via Cancel modifies the selected diagram object"

umbrello/umlwidgets/associationwidget.cpp
- In function slotMenuSelection case ListPopupMenu::mt_Line_Color, after
  returning from QColorDialog::getColor() require newColor.isValid() to
  return true as precondition for modifying the line color.

umbrello/umlwidgets/widgetbase.cpp
- In function slotMenuSelection cases mt_Line_Color_Selection and
  mt_Fill_Color_Selection, after returning from QColorDialog::getColor()
  require newColor.isValid() to return true as precondition for
  modifying the color.
- Move opening brace outside #if / #else / #endif to avoid imbalance
  with closing brace.

M  +3    -2    umbrello/umlwidgets/associationwidget.cpp
M  +9    -6    umbrello/umlwidgets/widgetbase.cpp

https://invent.kde.org/sdk/umbrello/commit/eac23da83da18c4f966e4a01b948be7404156123