D18463: Workaround the bug found by ASan, which can be seen on FreeBSD CI.

Gleb Popov noreply at phabricator.kde.org
Wed Jan 23 06:33:56 GMT 2019

arrowd created this revision.
Herald added a project: KDevelop.
Herald added a subscriber: kdevelop-devel.
arrowd requested review of this revision.

  Currently many tests fail (at least on FreeBSD) with ASan turned on. This is what happening:
  - `test_toolviewtoolbar` creates an action, a `ToolDocument` and a `View` in the `init()` function.
  - `ToolViewAction` registers itself as event filter for the created `View`.
  - When `cleanup` is called, the controller gets deleted. This causes removal of its children (`QObject::deleteChildren()`), included the mentioned `View`.
  - Somewhere later during destruction, some `QEvent` arrives and gets passed to `ToolViewAction::eventFilter()`. This function accesses `->widget()` method of `m_dock->view()`, but that `View` is already deleted, which causes ASan error.
  Note that adding `removeEventFilter()` to `ToolViewAction::~ToolViewAction()` doesn't solve the problem - the event arrival happens before `ToolViewAction` destruction. I take it, there is some ownage confusion, but I wasn't able to figure it out.
  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.
  I'd be happy to fix this proper way, but need some clues on where to dig.

  R32 KDevelop




To: arrowd
Cc: kdevelop-devel, #kdevelop, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190123/77a4cc5e/attachment.html>

More information about the KDevelop-devel mailing list