1

Closed

File Handle for .png files not closed

description

If you click on a .png file, it display correctly, but if you then click on a different file and come back to the first, you get this error:
 

Detailed technical information follows:

Date and Time: 27/10/2010 5:11:47 p.m.
Machine Name: NZC-SPILGRIM
IP Address: 10.1.57.96
Current User: AP\SPILGRIM
 
Application Domain: gbexplorer.vshost.exe
Assembly Codebase: file:///C:/dev/goldbox/Explorer/bin/Debug/gbexplorer.EXE
Assembly Full Name: gbexplorer, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
Assembly Version: 0.4.0.0
Assembly Build Date: 27/10/2010 4:15:12 p.m.
 
Exception Source: mscorlib
Exception Type: System.IO.IOException
Exception Message: The process cannot access the file 'c:\games\TREASURE\TITLE_005_VGA.PNG' because it is being used by another process.
Exception Target Site: WinIOError
 
---- Stack Trace ----
System.IO.__Error.WinIOError(errorCode As Int32, maybeFullPath As String)
   gbexplorer.EXE: N 7717104
System.IO.FileStream.Init(path As String, mode As FileMode, access As FileAccess, rights As Int32, useRights As Boolean, share As FileShare, bufferSize As Int32, options As FileOptions, secAttrs As SECURITY_ATTRIBUTES, msgPath As String, bFromProxy As Boolean)
   gbexplorer.EXE: N 01162
System.IO.FileStream..ctor(path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Int32, options As FileOptions, msgPath As String, bFromProxy As Boolean)
   gbexplorer.EXE: N 00061
System.IO.FileStream..ctor(path As String, mode As FileMode)
   gbexplorer.EXE: N 00055
DaxFileLibrary.Specs.FruaGlbFileSpecifcation.IsSatisfiedBy(parameters As GoldBoxFileParameters)
   FruaGlbFileSpecifcation.cs: line 0010, col 19, IL 0007
DaxFileLibrary.Factory.GoldBoxFileFactory.CreateUsing(parameters As GoldBoxFileParameters)
   GoldBoxFileFactory.cs: line 0021, col 13, IL 0111
GoldBoxExplorer.MainViewPresenter.ProcessFile()
   MainViewPresenter.cs: line 0104, col 17, IL 0080
Closed Feb 21, 2011 at 2:33 PM by bsimser

comments

SimeonPilgrim wrote Oct 28, 2010 at 8:57 PM

Problem is the ImageFileViewer class is constructing the Bitmap via the file name which holds the file locked for the life of the Bitmap object.

In my patch, I open the file load the contents to a byte[] and wrap in a MemoryStream, which means the file can be loaded multiple times.

wrote Nov 9, 2010 at 2:21 PM

bsimser wrote Feb 21, 2011 at 12:17 PM

Is this committed to a changeset yet (you mention patch but not sure what that's referring to)

bsimser wrote Feb 21, 2011 at 12:19 PM

Never mind, found the commit in the issue log. Thanks!

wrote Feb 21, 2011 at 12:19 PM

wrote Feb 21, 2011 at 2:33 PM

wrote Feb 13, 2013 at 10:27 PM

wrote May 16, 2013 at 5:52 AM