[Qt-interest] Unable to remove QTemporary file: "Access is denied" on windows xp

Mika Rajala mika_rajala_2 at hotmail.com
Thu Jun 10 14:09:03 CEST 2010


This just in.

 

I made a small test application that tried to use the QTemporaryFile object in a manner similar to what i'm doing in the real program. And little to my surprise it worked as it should. This was when i remembered that i hadn't supplied all necessary information, i'm using QTemporaryFile object from a static library that's linked to a dynamic library which is then imported into the executable. (dll is loaded automatically when the program is started).

 

There appears to be some difference if i use QTemporaryFile objects from a library that is statically linked to a dynamic library that i use from the executable.

 

Perhaps i'm doing something terribly wrong?

 

-mika
 


From: mika_rajala_2 at hotmail.com
To: qt-interest at trolltech.com
Date: Thu, 10 Jun 2010 11:33:08 +0000
Subject: Re: [Qt-interest] Unable to remove QTemporary file: "Access is denied" on windows xp



Fixed:
 
Sorry for your inconvinience.
 
-mika
 



From: mika_rajala_2 at hotmail.com
To: qt-interest at trolltech.com
Date: Thu, 10 Jun 2010 11:27:01 +0000
Subject: [Qt-interest] Unable to remove QTemproray file: "Access is denied" on windows xp



Hello
 
[Windows XP SP2, Visual Studio 2005 with SP1, Qt 4.6.1]
 
I'm trying to create a program that caches some of it's data to disk, to save memory.
 
QTemporaryFile seemed to be just the thing i'd need.
 
However, when it's deleted, the file isn't removed. (auto remove option is turned on by default)
 
Debugging with visual studio revealed that an error occurs while attempting to delete the file, an error string is also present and it contains "Access is denied".
 
I have tried giving various open-modes and permissions, but the file still persists.
 
I even tried to use QFile to access the files, but even there remove failed.
 
Deleting the file works, if i delete it from
-Windows file explorer
-QFile::remove(<path to file>);
 
The second option only works if i don't attempt to do it from the same process. The time it worked the old process had already ended.
 
Any ideas on what I might be missing here?
 
-mika





Tutustu videoiden avulla Windows Live tuotteisiin. Opi mestariksi.



Tutustu videoiden avulla Windows Live tuotteisiin. Opi mestariksi. 		 	   		  
_________________________________________________________________
Tutustu videoiden avulla Windows Live tuotteisiin.
http://www.microsoft.fi/live
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100610/ee4bb07d/attachment.html 


More information about the Qt-interest-old mailing list