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

List:       kwin
Subject:    Re: Review Request: some stashed changes I want to share
From:       Thomas_Lübking <thomas.luebking () web ! de>
Date:       2012-12-06 21:06:08
Message-ID: 20121206210608.17401.82917 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Dec. 6, 2012, 2:45 p.m., Thomas Lübking wrote:
> > It could last a little until Martin replies but afaics, the correct fix is to \
> > NULL s_compositor in the Compositor destruction "if (this == s_compositor) \
> > s_compositor = NULL;"
> 
> Jaime Torres Amate wrote:
> I've tried your proposal, and I get this crash:
> ASSERT: "s_compositor" in file kde-workspace/kwin/composite.h, line 142
> in
> static Compositor *self() {
> Q_ASSERT(s_compositor);
> return s_compositor;
> }
> 
> 
> Martin Gräßlin wrote:
> maybe we could just get rid of the m_compositor in workspace completely and add a \
> static destroy() to Compositor. Not sure why we carry the variable around but my \
> guess is that we do not use it at all.

Yes, we can - though it's atm. used quite some.

However this is of course now equal to accessing Compositor::self() which is \
::createCompositor(this) unconditionally what means that  deleting the compositor \
should actually not be necessary at all, since it's a singleton QObject parented by \
the singleton Workspace QObject (thus deleted by moc) and even supposed to kinda live \
and die with KApplication (ie. when the kernel frees the memory anyway)

The only advance of deleting the cmpositor early seems to prevent it from acting on \
those window releases, what should be equal to an early \
"Compositor::self()->finish();"


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107603/#review23068
-----------------------------------------------------------


On Dec. 6, 2012, 11:56 a.m., Jaime Torres Amate wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107603/
> -----------------------------------------------------------
> 
> (Updated Dec. 6, 2012, 11:56 a.m.)
> 
> 
> Review request for kwin.
> 
> 
> Description
> -------
> 
> * Avoid two initializations (one is enough and faster)
> * Delete m_compositor after doing other cleanups. Avoid a valgrind read-error \
> reading a deleted value when doing valgrind --log-file=kwin.log kwin --replace, \
>                 wait until all the windows get a border... in another konsole \
>                 launch kwin --replace
> * Initialize a member pointer
> * place the parenthesis in the right position to check if floats.count()<2 after \
> assigning the result to forced_align 
> 
> Diffs
> -----
> 
> kwin/events.cpp 281f9e7 
> kwin/kcmkwin/kwindesktop/desktopnameswidget.cpp 34e5e23 
> kwin/libkwineffects/anidata.cpp f1a07d4 
> kwin/workspace.cpp f80649d 
> 
> Diff: http://git.reviewboard.kde.org/r/107603/diff/
> 
> 
> Testing
> -------
> 
> The valgrind read-error:
> Before:
> ==19359== Invalid read of size 8
> ==19359==    at 0x4EF19AE: KWin::Toplevel::compositing() const (composite.cpp:934)
> ==19359==    by 0x4EF2E08: KWin::Toplevel::addWorkspaceRepaint(QRect const&) \
> (composite.cpp:1104) ==19359==    by 0x4E96B29: KWin::Client::releaseWindow(bool) \
> (client.cpp:269) ==19359==    by 0x4E7F2E8: KWin::Workspace::~Workspace() \
> (workspace.cpp:530) ==19359==    by 0x4E7F768: KWin::Workspace::~Workspace() \
> (workspace.cpp:564) ==19359==    by 0x4EA9060: KWin::Application::lostSelection() \
> (main.cpp:354) ==19359==    by 0xA6C695E: QMetaObject::activate(QObject*, \
> QMetaObject const*, int, void**) (qobject.cpp:3543) ==19359==    by 0x993DCA6: \
> KSelectionOwner::filterEvent(_XEvent*) (kmanagerselection.cpp:224) ==19359==    by \
> 0x98D60A4: KApplication::x11EventFilter(_XEvent*) (kapplication.cpp:930) ==19359==  \
> by 0xAF0B4D3: qt_x11EventFilter(_XEvent*) (qapplication_x11.cpp:435) ==19359==    \
> by 0xAF1A412: QApplication::x11ProcessEvent(_XEvent*) (qapplication_x11.cpp:3351) \
> ==19359==    by 0xAF42CC6: \
> QEventDispatcherX11::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) \
> (qeventdispatcher_x11.cpp:132) ==19359==  Address 0x1e08f5c0 is 224 bytes inside a \
> block of size 232 free'd ==19359==    at 0x4C2AA9C: operator delete(void*) (in \
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==19359==    by 0x4E7F26F: \
> KWin::Workspace::~Workspace() (workspace.cpp:517) ==19359==    by 0x4E7F768: \
> KWin::Workspace::~Workspace() (workspace.cpp:564) ==19359==    by 0x4EA9060: \
> KWin::Application::lostSelection() (main.cpp:354) ==19359==    by 0xA6C695E: \
> QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3543) \
> ==19359==    by 0x993DCA6: KSelectionOwner::filterEvent(_XEvent*) \
> (kmanagerselection.cpp:224) ==19359==    by 0x98D60A4: \
> KApplication::x11EventFilter(_XEvent*) (kapplication.cpp:930) ==19359==    by \
> 0xAF0B4D3: qt_x11EventFilter(_XEvent*) (qapplication_x11.cpp:435) ==19359==    by \
> 0xAF1A412: QApplication::x11ProcessEvent(_XEvent*) (qapplication_x11.cpp:3351) \
> ==19359==    by 0xAF42CC6: \
> QEventDispatcherX11::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) \
> (qeventdispatcher_x11.cpp:132) ==19359==    by 0xA6AD72E: \
> QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) \
> (qeventloop.cpp:149) ==19359==    by 0xA6AD9E7: \
> QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:204) 
> After... gone.
> I've been using the changed kwin almost a month.
> 
> 
> Thanks,
> 
> Jaime Torres Amate
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/107603/">http://git.reviewboard.kde.org/r/107603/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On December 6th, 2012, 2:45 p.m., <b>Thomas \
Lübking</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">It could last a little until Martin replies but afaics, the correct fix \
is to NULL s_compositor in the Compositor destruction &quot;if (this == s_compositor) \
s_compositor = NULL;&quot;</pre>  </blockquote>




 <p>On December 6th, 2012, 5:12 p.m., <b>Jaime Torres Amate</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I&#39;ve tried your \
                proposal, and I get this crash:
ASSERT: &quot;s_compositor&quot; in file kde-workspace/kwin/composite.h, line 142
in
    static Compositor *self() {
        Q_ASSERT(s_compositor);
        return s_compositor;
    }
</pre>
 </blockquote>





 <p>On December 6th, 2012, 7:21 p.m., <b>Martin Gräßlin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">maybe we could just get \
rid of the m_compositor in workspace completely and add a static destroy() to \
Compositor. Not sure why we carry the variable around but my guess is that we do not \
use it at all.</pre>  </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes, we can - though \
it&#39;s atm. used quite some.

However this is of course now equal to accessing Compositor::self() which is \
::createCompositor(this) unconditionally what means that  deleting the compositor \
should actually not be necessary at all, since it&#39;s a singleton QObject parented \
by the singleton Workspace QObject (thus deleted by moc) and even supposed to kinda \
live and die with KApplication (ie. when the kernel frees the memory anyway)

The only advance of deleting the cmpositor early seems to prevent it from acting on \
those window releases, what should be equal to an early \
&quot;Compositor::self()-&gt;finish();&quot;</pre> <br />








<p>- Thomas</p>


<br />
<p>On December 6th, 2012, 11:56 a.m., Jaime Torres Amate wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kwin.</div>
<div>By Jaime Torres Amate.</div>


<p style="color: grey;"><i>Updated Dec. 6, 2012, 11:56 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
                break-word;">* Avoid two initializations (one is enough and faster)
* Delete m_compositor after doing other cleanups. Avoid a valgrind read-error reading \
a deleted value when doing valgrind --log-file=kwin.log kwin --replace, wait until \
                all the windows get a border... in another konsole launch kwin \
                --replace
* Initialize a member pointer
* place the parenthesis in the right position to check if floats.count()&lt;2 after \
assigning the result to forced_align</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">The valgrind read-error: Before:
==19359== Invalid read of size 8
==19359==    at 0x4EF19AE: KWin::Toplevel::compositing() const (composite.cpp:934)
==19359==    by 0x4EF2E08: KWin::Toplevel::addWorkspaceRepaint(QRect const&amp;) \
(composite.cpp:1104) ==19359==    by 0x4E96B29: KWin::Client::releaseWindow(bool) \
(client.cpp:269) ==19359==    by 0x4E7F2E8: KWin::Workspace::~Workspace() \
(workspace.cpp:530) ==19359==    by 0x4E7F768: KWin::Workspace::~Workspace() \
(workspace.cpp:564) ==19359==    by 0x4EA9060: KWin::Application::lostSelection() \
(main.cpp:354) ==19359==    by 0xA6C695E: QMetaObject::activate(QObject*, QMetaObject \
const*, int, void**) (qobject.cpp:3543) ==19359==    by 0x993DCA6: \
KSelectionOwner::filterEvent(_XEvent*) (kmanagerselection.cpp:224) ==19359==    by \
0x98D60A4: KApplication::x11EventFilter(_XEvent*) (kapplication.cpp:930) ==19359==    \
by 0xAF0B4D3: qt_x11EventFilter(_XEvent*) (qapplication_x11.cpp:435) ==19359==    by \
0xAF1A412: QApplication::x11ProcessEvent(_XEvent*) (qapplication_x11.cpp:3351) \
==19359==    by 0xAF42CC6: \
QEventDispatcherX11::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) \
(qeventdispatcher_x11.cpp:132) ==19359==  Address 0x1e08f5c0 is 224 bytes inside a \
block of size 232 free&#39;d ==19359==    at 0x4C2AA9C: operator delete(void*) (in \
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==19359==    by 0x4E7F26F: \
KWin::Workspace::~Workspace() (workspace.cpp:517) ==19359==    by 0x4E7F768: \
KWin::Workspace::~Workspace() (workspace.cpp:564) ==19359==    by 0x4EA9060: \
KWin::Application::lostSelection() (main.cpp:354) ==19359==    by 0xA6C695E: \
QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3543) \
==19359==    by 0x993DCA6: KSelectionOwner::filterEvent(_XEvent*) \
(kmanagerselection.cpp:224) ==19359==    by 0x98D60A4: \
KApplication::x11EventFilter(_XEvent*) (kapplication.cpp:930) ==19359==    by \
0xAF0B4D3: qt_x11EventFilter(_XEvent*) (qapplication_x11.cpp:435) ==19359==    by \
0xAF1A412: QApplication::x11ProcessEvent(_XEvent*) (qapplication_x11.cpp:3351) \
==19359==    by 0xAF42CC6: \
QEventDispatcherX11::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) \
(qeventdispatcher_x11.cpp:132) ==19359==    by 0xA6AD72E: \
QEventLoop::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) \
(qeventloop.cpp:149) ==19359==    by 0xA6AD9E7: \
QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) (qeventloop.cpp:204)

After... gone.
I&#39;ve been using the changed kwin almost a month.</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/events.cpp <span style="color: grey">(281f9e7)</span></li>

 <li>kwin/kcmkwin/kwindesktop/desktopnameswidget.cpp <span style="color: \
grey">(34e5e23)</span></li>

 <li>kwin/libkwineffects/anidata.cpp <span style="color: grey">(f1a07d4)</span></li>

 <li>kwin/workspace.cpp <span style="color: grey">(f80649d)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107603/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


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

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