[Interest] QFile fails on Windows when screen is locked with message "device not open"?

Shantanu Tushar shaan7in at gmail.com
Wed Dec 6 13:58:32 CET 2017


Most likely the "device not open" message is being output when you
call `.exists()` on the file, followed by your qDebug.

On Wed, Dec 6, 2017 at 6:23 PM, Emre Besirik <nomercy at gmail.com> wrote:
>
>> On 5 Dec 2017, at 18:39, Thiago Apperantly <thiago.macieira at intel.com> wrote:
>>
>> On Tuesday, 5 December 2017 03:26:41 PST Emre Besirik wrote:
>>> Hello list,
>>> QFile fails on Windows when screen is locked with message "device not open”?
>>> And it is on new QFile(“somefile.txt”) not on file.open(ReadOnly).
>>
>> Your analysis cannot be right. The QFile creation does not touch the file or
>> even tell the operating system about the file until you try to open. There are
>> no system calls until then.
>>
>> --
>> Thiago Macieira - thiago.macieira (AT) intel.com
>>  Software Architect - Intel Open Source Technology Center
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>
> Apparently the problem was where and by whom it was called. It was being called from a callback funtion for EnumDisplayMonitors and when station is locked it does not work, and it does indeed fail on new QFile(“some.txt”) line, that I’m sure of it because the next line is
> if(!file.exists()) qDebug() << “File Does not exist”;
> and it outputs “device not open” before “File Does not exist”.
> So it fails on new QFile(“some.txt”)
>
> Best Regards,
> Emre Besirik
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



-- 
Shantanu Tushar    (UTC +0530)
shantanu.io



More information about the Interest mailing list