jgfoster / Jade

Jade is an Alternative Development Environment (IDE) for GemStone/S that runs on Microsoft Windows
MIT License
5 stars 2 forks source link

File In Code, Jade get frozen #61

Closed PeterMoe closed 1 year ago

PeterMoe commented 2 years ago

Hi James,

when i do a "File in Code" with a File that will rise a MessageBox (a File with command not supported from Jade, like fileformat or a class not found Compiler Error), Jade .exe get frozen and JadeDevImage too.

When i comment the last (line 16) "semaphore wait" or change to "semaphore signal" on method "JadeFileIn >> read" the Message will be shown again witout a Jade Freeze and "File In" with correct file works too.

I am not familiar with the semaphore stuff so i don't know if this is a correct solution and i don't know why you have add the semaphore blocks with commit "43bd9f7 - Fix file-in walkback and hang problem".

Regards Peter

PeterMoe commented 2 years ago

Now i understand why you need the "semaphore wait", if the "File in Code - File" is too big/slow, we lose the instance information on the FileStream (file).

So we need to handle the correct "terminate" of the "semaphore wait" if MessageBox is rised.

When I comment the Changes from the commit "43bd9f7 - Fix file-in walkback and hang problem":

JadeFileIn --> read

    "| semaphore |
    semaphore := Semaphore new.
    ["
        stream reset.
        "["
            ProgressDialog showModalWhile: [:progress |
                self readWithProgress: progress.
        "       semaphore signal."
            ].
        "] ifCurtailed: [
            semaphore signal.
        ].
    ] forkAt: Processor userBackgroundPriority.
    semaphore wait."

and in:

JadeFileIn --> readWithProgressA: progress

    [
        stream atEnd not.
    ] whileTrue: [
        line := stream nextLine.
        "["
            progress 
                value: stream position * 100 // stream size;
                text: line;
                yourself.
        "] forkAt: Processor userSchedulingPriority."
        [
            self processLine.
        ] on: TerminateProcess do: [:ex | 
            stream setToEnd.
            ex return.      "No need to terminate this Dolphin process (which is the default behavior)"
        ].
    ].

I don't get any timing problems or unexpected errors. I can File in Code with 100k rows. and get every error or feedback from the File in Code processing.