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

Random order of XML attributes when saving #73

Closed
mgunyho opened this issue Jun 26, 2019 · 6 comments
Closed

Random order of XML attributes when saving #73

mgunyho opened this issue Jun 26, 2019 · 6 comments

Comments

@mgunyho
Copy link

mgunyho commented Jun 26, 2019

If I open a syncdata file and save it, the attributes in the XML row, value and interpolation are shuffled each time, and git thinks all keys in the file have been rewritten. This makes merging files a headache. Apparently, this is caused by QDomElement.setAttribute (here) storing the keys in a hashmap, which shuffles the keys on purpose (see here). This could be fixed by seeding the hash as suggested in the SO thread.

@kusma
Copy link
Member

kusma commented Jun 26, 2019

Hmm, interesting. I haven't seen this behavior myself, so I wonder if this is dependent on Qt versions... I also wasn't aware that QtXML is deprecated, which I think is a strong argument to rewrite the code to use QXmlStreamReader/QXmlStreamWriter instead... I think the old Qt4 support can be binned anyway.

@kusma
Copy link
Member

kusma commented Jun 26, 2019

This behavior started in Qt5.6. The automated windows build (which is what I use) use Qt5.5. This explains why I haven't seen this behavior.

Thanks for reporting. I think a quick fix should be easy to do, like you suggest.

@kusma
Copy link
Member

kusma commented Jul 21, 2019

Hmm, I just tried to reproduce this on Qt 5.11 on Ubuntu, and I seem to get consistent behavior...

@mgunyho: What environment do you trigger this under?

@kusma
Copy link
Member

kusma commented Jul 21, 2019

OK, never mind. I managed to trigger it after some more tries. I had to restart the editor in between, I guess the hash stays constant.

@kusma
Copy link
Member

kusma commented Jul 21, 2019

@mgunyho: OK, could you check if #74 fixes the issue for you?

@mgunyho
Copy link
Author

mgunyho commented Jul 26, 2019

Seems to work, thanks!

@kusma kusma closed this as completed Apr 7, 2020
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

No branches or pull requests

2 participants