Printable Version of Topic

Click here to view this topic in its original format

AMIP Community _ Bug Reports _ AMIP crashs if outputfile is readonly or being accessed [Foobar2k Plugin]

Posted by: Trampi Sep 21 2008, 11:14 AM

Hello.
I use the fileoutput-function of AMIP to display current song and so on on my little Character-LCD.
So i've written a script which reads from the file which AMIP puts out.

Code i use:

CODE

$if(%playing,%1
%2
[%pm:%ps/%min:%sec]
Playing,)



Now if AMIP wants to write, i've checked the setting that it writes every second, AMIP (and Foobar) crashs, because it can't write. First i were not sure if my script maybe does something that could crash, but after i did some tests i am sure that AMIP crashs if the outputfile is read only or an open handle exists when other programs write or read.

You can try it yourself if you make the outputfile read only. AMIP will crash. I've tested this bug only using foobar, don't know if the bug also exists when using winamp etc..

In my opinion it just shouldn't crash.
I've already tried numerous things in my script that it doesn't open the file when AMIP will access it, but i've only achieved that it crashs every 1-10 minutes.

So, my solution would be the following.

Actual pseudocode:
CODE
FileWrite(Outputfile)


New pseudocode:
CODE
If not IsInUse(outputfile)
    FileWrite(outputfile)
EndIf


Because of the option "Refresh file every second" it will be tested in a second again if its now writeable. If it is - write. If not - wait 1 second and try again.


Thanks in advance and sorry for my bad english.
I hope anyone understands what i want to say.
Trampi

Posted by: Serge Sep 21 2008, 01:01 PM

Nice catch. I've fixed the problem. Replace your amip.dll with this version: http://amip.tools-for.net/files/test/amip.dll .

Posted by: Trampi Sep 21 2008, 02:03 PM

Thanks for your fast fix - seems to be working. smile.gif

Ohh, by the way, i've forgotten to say "Thanks!" for this very good Plugin/Program. It has so many nice features!
Keep on programming it!
It helped me a lot to get the output for my lcd.

Trampi

Powered by Invision Power Board
© Invision Power Services