From 9525a9a267325d7a4ef7bcdbe750ef941e998d0e Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sun, 13 Sep 2009 17:15:56 +0000 Subject: [PATCH] clean up the svg if we change the image strategy svn path=/trunk/KDE/kdelibs/; revision=1022990 --- widgets/checkbox.cpp | 4 ++++ widgets/label.cpp | 4 ++++ widgets/pushbutton.cpp | 4 ++++ widgets/radiobutton.cpp | 4 ++++ widgets/toolbutton.cpp | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/widgets/checkbox.cpp b/widgets/checkbox.cpp index c441199d9..54ec9a190 100644 --- a/widgets/checkbox.cpp +++ b/widgets/checkbox.cpp @@ -48,6 +48,8 @@ public: void setPixmap() { if (imagePath.isEmpty()) { + delete svg; + svg = 0; return; } @@ -65,6 +67,8 @@ public: QPainter p(&pm); svg->paint(&p, pm.rect()); } else { + delete svg; + svg = 0; pm = QPixmap(absImagePath); } diff --git a/widgets/label.cpp b/widgets/label.cpp index ea113c2fe..e2b032199 100644 --- a/widgets/label.cpp +++ b/widgets/label.cpp @@ -52,6 +52,8 @@ public: void setPixmap() { if (imagePath.isEmpty()) { + delete svg; + svg = 0; return; } @@ -69,6 +71,8 @@ public: QPainter p(&pm); svg->paint(&p, pm.rect()); } else { + delete svg; + svg = 0; pm = QPixmap(absImagePath); } diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index 964e832b0..1c00d85d6 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -62,6 +62,8 @@ public: void setPixmap() { if (imagePath.isEmpty()) { + delete svg; + svg = 0; return; } @@ -92,6 +94,8 @@ public: svg->paint(&p, pm.rect()); } } else { + delete svg; + svg = 0; pm = QPixmap(absImagePath); } diff --git a/widgets/radiobutton.cpp b/widgets/radiobutton.cpp index 2728d7f11..cbcd708e9 100644 --- a/widgets/radiobutton.cpp +++ b/widgets/radiobutton.cpp @@ -48,6 +48,8 @@ public: void setPixmap() { if (imagePath.isEmpty()) { + delete svg; + svg = 0; return; } @@ -65,6 +67,8 @@ public: QPainter p(&pm); svg->paint(&p, pm.rect()); } else { + delete svg; + svg = 0; pm = QPixmap(absImagePath); } diff --git a/widgets/toolbutton.cpp b/widgets/toolbutton.cpp index 3a63469d3..e59691c30 100644 --- a/widgets/toolbutton.cpp +++ b/widgets/toolbutton.cpp @@ -62,6 +62,8 @@ public: void setPixmap() { if (imagePath.isEmpty()) { + delete svg; + svg = 0; return; } @@ -92,6 +94,8 @@ public: svg->paint(&p, pm.rect()); } } else { + delete svg; + svg = 0; pm = QPixmap(absImagePath); }