Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectListModel: Fix assert in objectRemovedMainThread #73

Merged
merged 1 commit into from
Mar 18, 2014

Conversation

krf
Copy link
Contributor

@krf krf commented Mar 12, 2014

It's not safe to assume that m_invalidatedObjects does not contain obj in
case objectRemovedMainThread is called from the main thread.

We can end up in this order of calls:

  • objectRemoved from a thread other than the main thread
    • inserts obj into m_invalidatedObjects
    • queues a call to objectRemovedMainThread
  • objectAdded with the same obj-pointer
  • objectRemoved from the main thread
    • calls objectRemovedMainThread directly
    • m_invalidatedObjects still contains obj.
      => Assertion triggered

We fix this by always trying to remove obj from m_invalidatedObjects in
objectRemovedMainThread.

It's not safe to assume that m_invalidatedObjects does not contain obj in
case objectRemovedMainThread is called from the main thread.

We can end up in this order of calls:
- objectRemoved from a thread other than the main thread
  - inserts obj into m_invalidatedObjects
  - queues a call to objectRemovedMainThread
- objectAdded with the same obj-pointer
- objectRemoved from the main thread
  - calls objectRemovedMainThread directly
  - m_invalidatedObjects still contains obj.
=> Assertion triggered

We fix this by always trying to remove obj from m_invalidatedObjects in
objectRemovedMainThread.
@vkrause
Copy link
Contributor

vkrause commented Mar 13, 2014

Looks good to me, thanks!

krf added a commit that referenced this pull request Mar 18, 2014
ObjectListModel: Fix assert in objectRemovedMainThread
@krf krf merged commit bc0aca9 into KDAB:2.0 Mar 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants