Using KCompressionDevice with QSaveFile

Aleix Pol aleixpol at kde.org
Tue Dec 3 00:06:50 UTC 2013


On Mon, Dec 2, 2013 at 10:31 PM, Dominik Haumann <dhaumann at kde.org> wrote:

> Hi,
>
> porting KSaveFile to QSaveFile, I stumbled into the following:
>
> // This method has been made private so that it cannot be called,
> // in order to prevent mistakes.
> void QSaveFile::close()
> {
>     qFatal("QSaveFile::close called");
> }
>
> In Kate, we use a QSaveFile saveFile(...); and then use
>
>   KCompressionDevice compDevice(&saveFile, ...);
>
> to write compressed data through compDevice into saveFile.
>
> However, KCompressionDevice at some point always seems to call close(),
> which
> hits the qFatal().
>
> Should I derive from QSaveFile and overwrite close() to call commit() ?
> Am I missing something here?
>
> Greetings,
> Dominik
> _______________________________________________
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
>

Looks to me like it's either a bug on KCompressionDevice or QSaveFile.
Personally, I think it's rather odd that some public API call invariably
crashes (it's made private in QSaveFile, but it's still public on the
parent, so it's not very useful).

I'd say that this fix should go to Qt, but David will probably have a
better insight.
Mr Faure? :D

Aleix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20131203/0caa4406/attachment.html>


More information about the Kde-frameworks-devel mailing list