[PD-dev] open_via_path() weirdness

Martin Peach martin.peach at sympatico.ca
Tue Apr 28 00:28:36 CEST 2009


IOhannes m zmoelnig wrote:
> hi all,
> 
> in the course of trying to find the filehandle-leak bug in Gem i found a 
> weird problem with open_via_path().
> 
> can anybody find anything wrong with the attached code?
> if not, try the attached patch as well.

A minor thing is that you use #ifdef __WIN32__ instead of #ifdef MSW, 
which may or may not work.


> 
> everything works fine on linux, but on w32 i cannot close the 
> file-handle anymore (i get an errno of EBADF, which means that fd isn't 
> a valid open file descriptor).
> which in turn results in a filehandle leak.
> 

I don't know if it's related but I had trouble with the very similar 
canvas_open on WinXP in the [which] object. I compiled it with 
VisualStudioC++2005ExpressEdition against various pd.libs from Miller's 
site. Every time Pd would crash whenever i tried to use the fd, although 
the same code runs fine on linux (no need for a pd.lib there).
So imagine my surprise when which works fine when built as part of 
pd-extended on Hans' machine. So I think that I'm seeing some 
incompatibility of the dlls as made with MinGW and VC.

Martin




> i notice that hardly anyone (esp. Pd itself) uses open_via_path().
> is there a reason for that? is it buggy? (couldn't find anything wrong 
> though)
> 
> i use it quite a lot, e.g. in [msgfile]; i guess nobody ever tried to 
> open > 1000 files with msgfile on w32, so the error never appeared...
> 
> 
> fgamsdr
> IOhannes
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev





More information about the Pd-dev mailing list