Announcement

Collapse
No announcement yet.

File.setPosition crash

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • File.setPosition crash

    Signal 10.0.
    Will take a while to produce a simple example of what causes eSig to crash (not even a "Crash Report" dialog), but the basic scenario is
    within a try{}
    new File
    open actual file
    read it
    close it, but keep File object
    ... time passes , file is added to ..
    open actual file again
    setPosition to previous length
    boom! that code line does not return. So not much chance of reading the data.

    A bodge is to proceed to the previous position by reading it

    Ideally eSignal can establish existence of this bug without further input from me.

  • #2
    Re: File.setPosition crash

    Dave,

    I can make some guesses as to what the problem is, but that is a waste of my time as well as yours.

    I've never had success with setPosition method of the file object (and other similar methods - didn't think they were supported) till recently here.

    I have always written files, re-read them and re-write them. This has and continues to work fine for me.

    As per the forum policies, please post code that results in these problems. I can look at the code if you wish, validate the issue and reply. If it is a eSignal issue, they will resolve the issue.


    Originally posted by Dave180
    Signal 10.0.
    Will take a while to produce a simple example of what causes eSig to crash (not even a "Crash Report" dialog), but the basic scenario is
    within a try{}
    new File
    open actual file
    read it
    close it, but keep File object
    ... time passes , file is added to ..
    open actual file again
    setPosition to previous length
    boom! that code line does not return. So not much chance of reading the data.

    A bodge is to proceed to the previous position by reading it

    Ideally eSignal can establish existence of this bug without further input from me.

    Comment


    • #3
      thanks Steve, normally I do post code samples, but it just looks too time-consuming to chop this one down to something manageable.

      Comment


      • #4
        Hi Dave,

        I agree, trying to recreate the conditions that result in the problem your seeing would take quite a bit of time. Imagine how long it would take anyone to try and figure it out from scratch.

        Anyways, here is my best guess. I put a code snippet together to determine if your file object variable has been modified at some point. Perhaps it will be helpful. I tried to comment it as best I can, and put a link in the comments to explain some of the conditionals.

        All you need to do is paste my block of code just prior to the where you are having problems. Assign my 'gA' variable to your file object variable, that will allow you to use the code block 'as-is'.

        Hope this helps and please let me know what you find.


        Originally posted by Dave180
        thanks Steve, normally I do post code samples, but it just looks too time-consuming to chop this one down to something manageable.
        PHP Code:
        var gA=your variable;

        if(
        gA){ // if not undefined and not null, not zero (number or string), not false (boolean or string) will be enterpreted as true 
         
        debugPrintln("1: gA (vour variable) is evaluated as true -->> "+gA);
         
        //~ The constructor of your variable must be a file object, if not, that is your problem
         //~ Type conversion is performed between two operands when two Comparison Operators are used.
         //~ A Strict test is performed (both type and value) between two operands when three Comparison Operators are used. 
            //~ [url]http://www.javascriptkit.com/jsref/comparison_operators.shtml[/url] - Comparison and Logic Operators
         
        debugPrintln("2: gA = "+gA+" is it null? --> "+(gA==null)+", gA === null -->> "+(gA===null)+", type is -->> "+typeof(gA)+", is it a File Object? -->> "+(gA.constructor===File));
        }else{
         
        debugPrintln("3: gA (vour variable) is evaluated as false -->> "+gA);
         
        debugPrintln("4: gA === null -->> "+(gA===null)+",  gA == null -->> "+(gA==null));
         
        debugPrintln("5: gA === undefined -->> "+(gA===undefined)+", gA == undefined -->> "+(gA==undefined));
         if((
        gA!==undefined)&&(gA!==null)){
          
        debugPrintln("6: gA = "+gA+" is it null? --> "+(gA==null)+", gA === null -->> "+(gA===null)+", type is -->> "+typeof(gA)+", is it a File Object? -->> "+(gA.constructor===File));
         }

        Comment

        Working...
        X