[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.4/kdelibs/khtml/rendering
From:       Maks Orlovich <maksim () kde ! org>
Date:       2010-01-28 3:52:35
Message-ID: 1264650755.850277.22814.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1081282 by orlovich:

Backport:
SVN commit 1081278 by orlovich:

Change how we manage the proxy styles' lifetime, in order to avoid a nasty 
interraction which can occur if we hand-reset the style to normal on detach:
if we're detaching in response to a top-levels' deletion and setStyle(0) throws 
oxygen back-in, it may try to create some helper widgets for effects, which
will 
access memory of the half-destroyed top-level.

Instead, make the proxy the child of the widget --- it's deleted very late, 
so wouldn't be accessed (famous last words, I know) --- and this avoid style 
re-set. 

Will backport for rc3 despite the trickiness since it affects 
kipi-plugins, making it high-priority.

BUG: 224018



 M  +11 -6     render_form.cpp  


--- branches/KDE/4.4/kdelibs/khtml/rendering/render_form.cpp #1081281:1081282
@@ -88,7 +88,12 @@
     {
         KHTMLProxyStyle(QWidget *parent)
             : KdeUiProxyStyle(parent)
-        { noBorder = false; left = right = top = bottom = 0; m_proxy = \
qobject_cast<KdeUiProxyStyle*>(parent->style()); } +        {
+            noBorder = false;
+            left = right = top = bottom = 0;
+            m_proxy = qobject_cast<KdeUiProxyStyle*>(parent->style());
+            setParent(parent);
+        }
 
         QStyle* proxy() const { return m_proxy ? m_proxy : style(); }
 
@@ -178,11 +183,7 @@
 }
 
 RenderFormElement::~RenderFormElement()
-{
-    if (widget())
-        widget()->setStyle(0);
-    delete m_proxyStyle;
-}
+{}
 
 void RenderFormElement::setStyle(RenderStyle *style)
 {
@@ -253,6 +254,10 @@
 
 void RenderFormElement::setQWidget( QWidget *w )
 {
+    // Avoid dangling proxy pointer when we switch widgets.
+    // the widget will cleanup the proxy, as it is its kid.
+    m_proxyStyle = 0;
+
     // sets the Qt Object Name for the purposes
     // of setPadding() -- this is because QStyleSheet
     // will propagate children of 'w' even if they are toplevel, like


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic