Don't crash in wxFFile::Eof() and Error() if file is closed

Assert and return false instead, this is more developer-friendly.

Add unit tests to check that these functions really work as expected when
called on a closed file.

Closes #17828.
This commit is contained in:
jprotopopov
2017-04-01 18:38:14 +02:00
committed by Vadim Zeitlin
parent a05b1f39f5
commit 9b1afaa7a6
5 changed files with 79 additions and 11 deletions

View File

@@ -89,10 +89,7 @@ public:
Note that the behaviour of the file descriptor based class wxFile is different as
wxFile::Eof() will return @true here as soon as the last byte of the file has been read.
Also note that this method may only be called for opened files and may crash if
the file is not opened.
@todo THIS METHOD MAY CRASH? DOESN'T SOUND GOOD
Also note that this method may only be called for opened files. Otherwise it asserts and returns false.
@see IsOpened()
*/
@@ -102,10 +99,7 @@ public:
Returns @true if an error has occurred on this file, similar to the standard
@c ferror() function.
Please note that this method may only be called for opened files and may crash
if the file is not opened.
@todo THIS METHOD MAY CRASH? DOESN'T SOUND GOOD
Please note that this method may only be called for opened files. Otherwise it asserts and returns false.
@see IsOpened()
*/