Fix for Tree
ClosedPublic

Authored by bruleherman on Jun 13 2019, 4:01 PM.

Details

Summary

It fix when add file to folder after have attached folder to parent.
Work add file to folder before have attached folder to parent.

Fix count m_children when remove file from folder

Diff Detail

Repository
R352 Filelight
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruleherman created this revision.Jun 13 2019, 4:01 PM
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptJun 13 2019, 4:01 PM
bruleherman requested review of this revision.Jun 13 2019, 4:01 PM

Thanks for your patch! What repo is this for? It didn't get set automatically for some reason and i's not clear from looking at the diff or your description.

Hi,

It's for R352 Filelight.

Cheers,

Thanks! I have no idea why Phab didn't notice. :/

Can you please explain what bug you intend to fix here and how to test it?

I am not sure I understand what you are fixing in the append....
The way listing works is that we open a dir, iterate its entries, for each file entry we append a File* for each directory we recurse and then append the returned Folder* making the current Folder the parent and the returned Folder the child. That is to say: once a child gets a parent the child is complete, there are no more appends happening to that child.

You could add a Q_ASSERT(!parent()); to the top of the append and it should never crash there.

The remove change looks good though.

I fix:

  1. wrong count of m_children in parent after remove
  2. wrong root size when you add file at existing tree

If you don't use deleteFile, then remove the buggy method, else fix it 1)
In your code 2) will not append, but when some body (like me), reuse you code, and do it, it have problem because it can use it like that's.

I have implemented the code here:
https://github.com/alphaonex86/Ultracopier/tree/master/test/radialmap
And in my case I need append file after the root is constructed

Thanks, that does make sense now.

Seeing as this isn't a library it's not meant to be working for third party use. I appreciate your patch but in the interest of speed I'll leave the append() change out of the commit. As mentioned, there is no parent for us so the attempted loop is entirely unnecessary for our purposes.

I'll go ahead and land the bugfix updating m_children.

Thanks!

This revision was not accepted when it landed; it landed in state Needs Review.Jun 17 2019, 1:53 PM
This revision was automatically updated to reflect the committed changes.