From: Sean H. <jal...@ho...> - 2001-01-11 04:47:43
|
I had this problem before - I found a possible solution in the old archives (at http-tech), but it involved recompiling (if I recall correctly, the variable filterlen was not given a default value of 0, so when you specify a filter, the program tries to increment something that hasn't been set yet). Since I can't recompile, I shelved the program I was working on until a fixed version came out. I was using the last version, but I guess it's not working with 0.0502 yet, either. >can anyone out there recreate this: > >from perl call >my $filename = Win32::GUI::GetOpenFileName( > -filter => [ > "File type 1" => "*.ft1", > "File type 2" => "*.ft2", > ], >); > >now call this twice. The first time it works wonderfully, the second >time it causes my program to exit, and this is displayed: >Out of memory! >Callback called exit. >(I believe the message is from the perl interpreter rather than win32- >gui). > >I'd be interested to hear if anyone is using this function with >success (multiple times), as it may be a problem purely with my >build of win32-gui (0.0502) or perl (5.60). > >It doesn't seem to happen unless you specify a filter. All the other >options work perfectly. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com |
From: Sam <sa...@se...> - 2001-01-11 04:53:40
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sorry about essentially spamming this newsgroup, but I have a fix for the following problem (if anyone else is ever actually effected by it). in the GetOpenFileName XSUB; change to following code: int i, filterlen; char *fpointer; filters = (AV*)SvRV(ST(next_i)); for(i=0; i<=av_len(filters); i++) { t = av_fetch(filters, i, 0); if(t != NULL) { filterlen += SvCUR(*t) + 1; } } to: int i, filterlen = 0; /* <---- must initialize this */ char *fpointer; filters = (AV*)SvRV(ST(next_i)); for(i=0; i<=av_len(filters); i++) { t = av_fetch(filters, i, 0); if(t != NULL) { filterlen += SvCUR(*t) + 1; } } also (and _please_ correct me if I'm wrong) I've changed the following code a little, as I disagree with the pointer arithmetic. filterlen += 2; filter = (char *) safemalloc(filterlen); fpointer = filter; for(i=0; i<=av_len(filters); i++) { t = av_fetch(filters, i, 0); if(t != NULL) { strcpy(fpointer, SvPV_nolen(*t)); fpointer += SvCUR(*t); /* no + 1 */ *fpointer++ = 0; /* changed */ } } *fpointer = 0; /* changed */ ofn.lpstrFilter = (LPCTSTR) filter; hope this helps someone. If not then sorry for the needless traffic. > can anyone out there recreate this: > > from perl call > my $filename = Win32::GUI::GetOpenFileName( > -filter => [ > "File type 1" => "*.ft1", > "File type 2" => "*.ft2", > ], > ); > > now call this twice. The first time it works wonderfully, the second > time it causes my program to exit, and this is displayed: > Out of memory! > Callback called exit. > (I believe the message is from the perl interpreter rather than win32- > gui). > > I'd be interested to hear if anyone is using this function with > success (multiple times), as it may be a problem purely with my > build of win32-gui (0.0502) or perl (5.60). > > It doesn't seem to happen unless you specify a filter. All the other > options work perfectly. > > Sam Jacobson > R & D Manager / Software Engineer > Selective Communications > Ph +64 9 302 1142 > www.selective.co.nz > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > -----BEGIN PGP SIGNATURE----- Version: N/A iQA/AwUBOlyUuZsRND2Z+TaWEQJORACfVCEfJBH6Ca1zEb6snziJsxUzetUAoN8+ PHUzaUdISWfzkjz3Z7b507iX =BxIX -----END PGP SIGNATURE----- Sam Jacobson R & D Manager / Software Engineer Selective Communications Ph +64 9 302 1142 www.selective.co.nz |
From: Erick J. B. <er...@e-...> - 2001-01-11 21:25:42
|
I Can't even get the first call. > > my $filename = Win32::GUI::GetOpenFileName( > > -filter => [ > > "File type 1" => "*.ft1", > > "File type 2" => "*.ft2", > > ], > > ); > > I used the above code, but no results. The only way I can filter files is one file ending at a time, that is by placing a string (eg. "*.ft1") in the GetOpenFileName dialog. Like this, my $filename = Win32::GUI::GetOpenFileName( -file => "*.ft1" ); |
From: Sam <sa...@se...> - 2001-01-11 04:54:54
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I had this problem before - I found a possible solution in the old archives > (at http-tech), but it involved recompiling (if I recall correctly, the > variable filterlen was not given a default value of 0, so when you specify a > filter, the program tries to increment something that hasn't been set yet). > Since I can't recompile, I shelved the program I was working on until a > fixed version came out. I was using the last version, but I guess it's not > working with 0.0502 yet, either. thank you. (pity I didn't see this a few minutes ago). > >can anyone out there recreate this: > > > >from perl call > >my $filename = Win32::GUI::GetOpenFileName( > > -filter => [ > > "File type 1" => "*.ft1", > > "File type 2" => "*.ft2", > > ], > >); > > > >now call this twice. The first time it works wonderfully, the second > >time it causes my program to exit, and this is displayed: > >Out of memory! > >Callback called exit. > >(I believe the message is from the perl interpreter rather than win32- > >gui). > > > >I'd be interested to hear if anyone is using this function with > >success (multiple times), as it may be a problem purely with my > >build of win32-gui (0.0502) or perl (5.60). > > > >It doesn't seem to happen unless you specify a filter. All the other > >options work perfectly. > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > -----BEGIN PGP SIGNATURE----- Version: N/A iQA/AwUBOlyVD5sRND2Z+TaWEQKUhwCfTzqkuL+VU54ClRf64F3rq6FTRsQAoJvu bUAL+pbhg9JJhHG4VMbu4X4j =AwPo -----END PGP SIGNATURE----- Sam Jacobson R & D Manager / Software Engineer Selective Communications Ph +64 9 302 1142 www.selective.co.nz |