Fix crash due to Qthread being restarted and then deleted

Review Request #107656 - Created Dec. 10, 2012 and submitted

Information
Simeon Bird
kde-baseapps
master
302264
Reviewers
dolphin
freininghaus
commit c9ff067317155da63393f45d3adf543830fc866b
Author: Simeon Bird <bladud@gmail.com>
Date:   Sat Jan 12 10:43:26 2013 -0500

    A crash occurs if updateItemStates runs between the
    UpdateItemStatesThread finishing and the finished() signal being
    delivered.
    
    In this case, a new thread was not created, because the old thread still
    existed. However, pendingItemStatesUpdate was not set, because the thread was
    not running. Instead, the old thread was restarted.
    
    This meant that the finished() signal from the first run could be delivered
    while the thread was running for a second time, causing the thread to be
    deleted while still running and thus a crash.
    
    Solution: set pendingItemStatesUpdate if the thread is non-null, even if
    it is not running, knowing that slotThreadFinished has not yet run, and
    will call updateItemStates itself.
    
    BUG: 302264
    FIXED-IN: 4.10
    REVIEW: 107656

commit da96efba82abb8848c1288684babc1883ea8cc8d
Author: Simeon Bird <bladud@gmail.com>
Date:   Sat Jan 12 10:37:57 2013 -0500

    The locking around the plugin access in actions doesn't seem to be
    necessary, as actions is only called from the main thread.
    
    Also it wasn't checked consistently; if the lock could not be taken, the
    plugin was accessed anyway.

commit 89711faa7d7718ed35ff77fe5d2df3e502102ecf
Author: Simeon Bird <bladud@gmail.com>
Date:   Sat Jan 12 10:37:26 2013 -0500

    We don't need the mutex guarding m_itemStates in the
    UpdateItemStatesThread, because m_itemStates is only accessed by the
    when the thread is done, and set before the thread starts.
    
    Also combine the setData function with the constructor.
The crash can be made very easy to reproduce by shortening the verificationTimer in VersionControlObserver to 50msec. 
With this patch, the crash goes away.

Issues

  • 0
  • 2
  • 2
  • 4
Description From Last Updated
Frank Reininghaus
Simeon Bird
Simeon Bird
Frank Reininghaus
Simeon Bird
Frank Reininghaus
Commit Hook
Simeon Bird
Review request changed

Status: Closed (submitted)

Loading...