changeset 1750:5b5ef1888a47

first ref(), then unref() in Layout::setBgColor() In case new and old bgColor are the same thing, we need to avoid to delete bgColor by first unref()ing it.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sun, 17 Oct 2010 22:12:45 +0200
parents 1a3af54d6003
children 4eabd51a5d96
files dw/layout.cc
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dw/layout.cc	Sun Oct 17 21:41:31 2010 +0200
+++ b/dw/layout.cc	Sun Oct 17 22:12:45 2010 +0200
@@ -611,11 +611,13 @@
 
 void Layout::setBgColor (style::Color *color)
 {
+   color->ref ();
+
    if (bgColor)
       bgColor->unref ();
 
    bgColor = color;
-   bgColor->ref ();
+
    if (view)
       view->setBgColor (bgColor);
 }