RE: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-25 Thread Ian
 -Original Message-
 From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On
 Behalf Of Robert Pearce
 
 On Tue, 23 Mar 2010 18:08:05 -0700 you wrote:
  So only stdin/out/err are open and the cwd is not on the flash drive.
  What the heck else could be preventing Windows from un-mounting it?
 
 You could try (though it's unlikely to help) explicitly setting the
 file chooser's current directory to C:\ before you delete it.

Thanks, but already tried exactly that - didn't help.

Ian



___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


RE: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-25 Thread Ian
 -Original Message-
 From: Tor Lillqvist
 Sent: Wednesday, March 24, 2010 12:57 AM
 
 To see what files actually are open by a Windows process, you need to
 use Windows-specific code. Or use existing tools like Process Explorer

OK, tried that. After saving files to a Temp folder on the flash drive mounted 
as E:, process explorer show that the app has 3 files on it:

FileE:\
FileE:\
FileE:\Temp

Think this is worth a Bugzilla report against GtkFileChooserDialog?

Ian



___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-24 Thread Tor Lillqvist
 fd 0 is open !!
 fd 1 is open !!
 fd 2 is open !!

That is a rather pointless exercise as file descriptors on Windows
aren't an operating system concept, as on Unix. In C code on Windows,
file descriptors are just indexes into tables in the C library.
There might even be several different C libraries (with overlapping
but unrelated file descriptor values) in use by a process at any time.
(That is, one C library, say msvcrt.dll, used by the main .exe,
another, say msvcr80.dll, used by one DLL, and a third DLL might be
using a static C library. Etc.)

Files opened with operating system calls don't have any file descriptors.

To see what files actually are open by a Windows process, you need to
use Windows-specific code. Or use existing tools like Process Explorer
from http://technet.microsoft.com/en-gb/sysinternals/bb896653.aspx .

--tml
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-24 Thread Robert Pearce
Hi Ian,

On Tue, 23 Mar 2010 18:08:05 -0700 you wrote:
 So only stdin/out/err are open and the cwd is not on the flash drive. 
 What the heck else could be preventing Windows from un-mounting it?

Sadly it's probably some deep buried magic in Windows. The earlier post
about working directories was on the right lines, I suspect, except it's
not the application working directory that's the problem but some
internal cache record. I've seen this happen with Windows Exploder -
after browsing the flash drive it's sometimes not enough to browse away
and you need to close that explorer window to allow the safe removal.

You could try (though it's unlikely to help) explicitly setting the
file chooser's current directory to C:\ before you delete it.
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-24 Thread Jernej Simončič
On Tue, 23 Mar 2010 18:08:05 -0700, Ian Puleston wrote:

 So only stdin/out/err are open and the cwd is not on the flash drive. What 
 the heck else could be preventing Windows from un-mounting it?

Grab Process Explorer and use it's Find Handle or DLL function and just
search for the drive letter - that should tell you what has the flash drive
open.

-- 
 Jernej Simončič  http://eternallybored.org/ 

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-23 Thread Ian Puleston
Hi,

 

I have a program that exports files to a USB flash drive which involves
using a GtkFileChooserDialog created with
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER to browse to the flash drive (or a
folder on it) and then writing the files. The problem is that in Windows,
when all is done I cannot un-mount the memory stick (via the Windows Safely
remove hardware applet) because Windows reports that it is in use unless I
close the program first.

 

The file writes in the export process all do fopen, fputs, fclose so those
should not be causing this problem, and so I think it must be an effect of
the GtkFileChooserDialog. At the end of the export process I call
gtk_widget_destroy(dlgWin) where dlgWin was returned by
gtk_dialog_new_with_buttons.

 

Is there anything I might be missing to tidy up after the
GtkFileChooserDialog that might be causing this? I'm using GTK 2.16.6.

 

Thanks,

Ian

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-23 Thread Jernej Simončič
On Tue, 23 Mar 2010 16:42:34 -0700, Ian Puleston wrote:

 Is there anything I might be missing to tidy up after the
 GtkFileChooserDialog that might be causing this? I'm using GTK 2.16.6.

This is just a guess, but it might have changed the working directory to
your removable drive, and Windows will see this as the drive is in use. Try
using chdir to change to some other drive after you're done.

-- 
 Jernej Simončič  http://eternallybored.org/ 

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


RE: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-23 Thread Ian Puleston
 -Original Message-
 From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On
 Sent: Tuesday, March 23, 2010 4:48 PM
 
 On Tue, 23 Mar 2010 16:42:34 -0700, Ian Puleston wrote:
 
  Is there anything I might be missing to tidy up after the
  GtkFileChooserDialog that might be causing this? I'm using GTK
 2.16.6.
 
 This is just a guess, but it might have changed the working directory
 to your removable drive, and Windows will see this as the drive is in
 use. Try using chdir to change to some other drive after you're done.

Thanks but that doesn't seem to be the problem. The program is accessing files 
in its working directory, and after the export it can go on accessing them 
still which means the working directory did not change. But to be doubly-sure I 
just added a call to getcwd() after the export and g_printed the result and it 
shows the expected directory, not the flash drive.

Ian



___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


RE: Can't unmount flash drive after GtkFileChooserDialog in Windows

2010-03-23 Thread Ian Puleston
 -Original Message-
 From: Ian Puleston [mailto:i...@underpressuredivers.com]

 Is there anything I might be missing to tidy up after the
 GtkFileChooserDialog that might be causing this? I'm using GTK
 2.16.6.

I tried a hack to temporarily remove the call to the GtkFileChooserDialog and 
where it was calling gtk_file_chooser_get_current_folder I replaced that with a 
static string giving the path to the last drive. With this, after the export 
Windows could un-mount the flash drive just fine without closing the program. 
So this tells me that the problem does seem to be with the GtkFileChooserDialog.

Then (with the file chooser back in) as well as code to g_print the output of 
getcwd, I added a loop calling fstat on all file descriptors from 0 to 
0x with a g_print of those that return success (i.e. are open) and it 
printed this:

CWD: 'C:\SLRC\2010\Results\r6-GS-sq'
fd 0 is open !!
fd 1 is open !!
fd 2 is open !!

So only stdin/out/err are open and the cwd is not on the flash drive. What the 
heck else could be preventing Windows from un-mounting it?

Ian



___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list