Tile management with shared pointers instead of reference counting
AbandonedPublic

Authored by fazek on Mar 21 2016, 5:40 PM.

Details

Reviewers
dkazakov
rempt
Summary

The original method for releasing the tiles is using an atomic reference counter but it is not thread safe: it is possible for a thread to release and delete the tile while the other thread accessing it, because there is an unprotected time before increasing the reference counter. The goal of this modification was to use an automatic and atomic method to reference the tile right at the moment of access.

I used QSharedPointers which are defined as thread safe. The original code used exact points where the tiles released and deleted. Since there is a delicate locking mechanism and the release of any tiles should not happen during a locked operation, I tried to keep exactly the same release points by forced releasing and clearing of the pointer instances.

Test Plan

Use the program with these modifications and look for the problems. Try to create layers, load and save documents, create animation, draw animation keyframes. The only problem I found was some remaining leaked frames when exiting the program. I don't think it's related, since the original version also produced them.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
fazek updated this revision to Diff 2886.Mar 21 2016, 5:40 PM
fazek retitled this revision from to Tile management with shared pointers instead of reference counting.
fazek updated this object.
fazek edited the test plan for this revision. (Show Details)
fazek added reviewers: rempt, dkazakov.
fazek set the repository for this revision to R37 Krita.
dkazakov edited edge metadata.Mar 23 2016, 3:21 PM

Hi, @fazek!

Is your patch still actual? You said you have found some other bugs?

fazek abandoned this revision.Mar 23 2016, 4:37 PM

Hello @dkazakov,

I've found nothing. it seems the original version works perfectly. so now I abandon this revision, I hope these still remain here for the archive.

The bugs I mentioned came out during the tests, but not related. I've already a patch for one of them: D1199 (now I also added you as a reviewer), the other crash is related to some Color Picker thing but I have to investigate what really happened. Sorry for the troubles and thanks for your patience about this...