← Back to team overview

ayatana-commits team mailing list archive

[Branch ~agateau/plasma-widget-message-indicator/trunk] Rev 108: Clean up and avoid potential crash

 

------------------------------------------------------------
revno: 108
committer: Aurelien Gateau <aurelien.gateau@xxxxxxxxxxxxx>
branch nick: plasma-widget-message-indicator
timestamp: Tue 2010-02-09 11:34:28 +0100
message:
  Clean up and avoid potential crash
modified:
  src/message-indicator.cpp


--
lp:plasma-widget-message-indicator
https://code.launchpad.net/~agateau/plasma-widget-message-indicator/trunk

Your team ayatana-commits is subscribed to branch lp:plasma-widget-message-indicator.
To unsubscribe from this branch go to https://code.launchpad.net/~agateau/plasma-widget-message-indicator/trunk/+edit-subscription.
=== modified file 'src/message-indicator.cpp'
--- src/message-indicator.cpp	2010-01-15 10:26:42 +0000
+++ src/message-indicator.cpp	2010-02-09 10:34:28 +0000
@@ -135,11 +135,11 @@
 
 void MessageIndicator::initPalette()
 {
-    QPalette pal = mView->palette();
+    QPalette pal = widget()->palette();
     pal.setColor(QPalette::Base, Qt::transparent);
     QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
     pal.setColor(QPalette::Text, textColor);
-    mView->setPalette(pal);
+    widget()->setPalette(pal);
 }
 
 QWidget* MessageIndicator::widget()
@@ -163,9 +163,12 @@
 
 void MessageIndicator::adjustViewSize()
 {
-    QSize sh = mView->sizeHint();
+    QSize sh = widget()->sizeHint();
 
-    QWidget* dialog = mView->parentWidget();
+    QWidget* dialog = widget()->parentWidget();
+    if (!dialog) {
+        return;
+    }
     int left, top, right, bottom;
     dialog->getContentsMargins(&left, &top, &right, &bottom);