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

Make sure files are truncated before writing #3487

Merged
merged 1 commit into from Sep 14, 2016

Conversation

nyalldawson
Copy link
Collaborator

I might be misinterpreting the Qt docs - but I believe there's a lot of cases in master where we should be opening files for writing with the QIODevice::Truncate flag.

I hit an issue today where a file exported from the color list (gpl file) was not being correctly truncated and tracked it down to a missing Truncate flag. But searching through the code I've found lots of other instances were the flag is missing, and am surprised that we haven't seen the consequences of this before...

@wonder-sk
Copy link
Member

Seems like it is an issue only in Qt4. Looking at QIODevice::WriteOnly docs:

  • 4.8: The device is open for writing.
  • 5.7: The device is open for writing. Note that this mode implies Truncate.

@nyalldawson
Copy link
Collaborator Author

Maybe in 5.7. I was building with 5.5 when I experienced the issue...

@nyalldawson
Copy link
Collaborator Author

@wonder-sk so would you think this should be merged?

@wonder-sk
Copy link
Member

Yeah I think so...

@nyalldawson nyalldawson merged commit 5c1151c into qgis:master Sep 14, 2016
@nyalldawson nyalldawson deleted the truncate branch September 22, 2016 01:14
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.

None yet

2 participants