<table><tr><td style="">arrowd created this revision.<br />Herald added a project: KDevelop.<br />Herald added a subscriber: kdevelop-devel.<br />arrowd requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18463">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Currently many tests fail (at least on FreeBSD) with ASan turned on. This is what happening:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">test_toolviewtoolbar</tt> creates an action, a <tt style="background: #ebebeb; font-size: 13px;">ToolDocument</tt> and a <tt style="background: #ebebeb; font-size: 13px;">View</tt> in the <tt style="background: #ebebeb; font-size: 13px;">init()</tt> function.</li>
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">ToolViewAction</tt> registers itself as event filter for the created <tt style="background: #ebebeb; font-size: 13px;">View</tt>.</li>
<li class="remarkup-list-item">When <tt style="background: #ebebeb; font-size: 13px;">cleanup</tt> is called, the controller gets deleted. This causes removal of its children (<tt style="background: #ebebeb; font-size: 13px;">QObject::deleteChildren()</tt>), included the mentioned <tt style="background: #ebebeb; font-size: 13px;">View</tt>.</li>
<li class="remarkup-list-item">Somewhere later during destruction, some <tt style="background: #ebebeb; font-size: 13px;">QEvent</tt> arrives and gets passed to <tt style="background: #ebebeb; font-size: 13px;">ToolViewAction::eventFilter()</tt>. This function accesses <tt style="background: #ebebeb; font-size: 13px;">->widget()</tt> method of <tt style="background: #ebebeb; font-size: 13px;">m_dock->view()</tt>, but that <tt style="background: #ebebeb; font-size: 13px;">View</tt> is already deleted, which causes ASan error.</li>
</ul>

<p>Note that adding <tt style="background: #ebebeb; font-size: 13px;">removeEventFilter()</tt> to <tt style="background: #ebebeb; font-size: 13px;">ToolViewAction::~ToolViewAction()</tt> doesn't solve the problem - the event arrival happens before <tt style="background: #ebebeb; font-size: 13px;">ToolViewAction</tt> destruction. I take it, there is some ownage confusion, but I wasn't able to figure it out.</p>

<p>So, I just flipped the condition in the if statement and it happens that it is also false, so the second condition doesn't get executed anymore.</p>

<p>I'd be happy to fix this proper way, but need some clues on where to dig.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>BRANCH</strong><div><div>asan_worrkaround</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18463">https://phabricator.kde.org/D18463</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kdevplatform/sublime/idealbuttonbarwidget.cpp</div></div></div><br /><div><strong>To: </strong>arrowd<br /><strong>Cc: </strong>kdevelop-devel, KDevelop, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>