Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primitive error in _ScIDE_SetDocTextMirror called from openDocument #964

Closed
jamshark70 opened this issue Oct 1, 2013 · 8 comments
Closed
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE

Comments

@jamshark70
Copy link
Contributor

Updated from master today, rebuilt SC (cd build && make && sudo make install), then...

"~/share/SC/scd/simple-piano.scd".openDocument;

-->

ERROR: Primitive '_ScIDE_SetDocTextMirror' failed.
Wrong type.
RECEIVER:
Instance of ScIDEDocument {    (0x5ede8b8, gc=50, fmt=00, flg=00, set=05)
  instance variables [17]
    dataptr : nil
    keyDownAction : nil
    keyUpAction : nil
    mouseUpAction : nil
    toFrontAction : nil
    endFrontAction : nil
    onClose : nil
    mouseDownAction : nil
    stringColor : nil
    envir : nil
    savedEnvir : nil
    editable : nil
    quuid : nil
    title : nil
    isEdited : false
    path : nil
    textChangedAction : nil
}

PROTECTED CALL STACK:
    Meta_MethodError:new    0x1de3bc0
        arg this = PrimitiveFailedError
        arg what = Wrong type.
        arg receiver = a ScIDEDocument
    Meta_PrimitiveFailedError:new   0x1dea180
        arg this = PrimitiveFailedError
        arg receiver = a ScIDEDocument
    Object:primitiveFailed  0x1383400
        arg this = a ScIDEDocument
    ScIDEDocument:prSetTextMirror   0x295c600
        arg this = a ScIDEDocument
        arg quuid = nil
        arg text = (omitted)

    ScIDEDocument:prReadTextFromFile    0x29635c0
        arg this = a ScIDEDocument
        arg path = /home/dlm/share/SC/scd/simple-piano.scd
        var file = a File
    ScIDEDocument:initFromPath  0x2962b80
        arg this = a ScIDEDocument
        arg path = /home/dlm/share/SC/scd/simple-piano.scd
        arg selectionStart = 0
        arg selectionLength = 0
        var doc = nil
    Meta_Document:open  0x2934f80
        arg this = Document
        arg path = ~/share/SC/scd/simple-piano.scd
        arg selectionStart = 0
        arg selectionLength = 0
        arg envir = nil
        var doc = nil
    String:openDocument 0x3e59640
        arg this = ~/share/SC/scd/simple-piano.scd
        arg selectionStart = 0
        arg selectionLength = 0
        var ideClass = nil
    Interpreter:interpretPrintCmdLine   0x1bc0a40
        arg this = an Interpreter
        var res = nil
        var func = a Function
        var code = "~/share/SC/scd/simple-piano.scd".openDocument
        var doc = a ScIDEDocument
        var ideClass = ScIDE
    Process:interpretPrintCmdLine   0x1ad7440
        arg this = a Main

CALL STACK:
    MethodError:reportError   0x48d6f28
        arg this = <instance of PrimitiveFailedError>
    Nil:handleError   0x5d62cb8
        arg this = nil
        arg error = <instance of PrimitiveFailedError>
    Thread:handleError   0x5d621d8
        arg this = <instance of Thread>
        arg error = <instance of PrimitiveFailedError>
    Object:throw   0x5d628f8
        arg this = <instance of PrimitiveFailedError>
    Object:primitiveFailed   0x5d2d7e8
        arg this = <instance of ScIDEDocument>
    ScIDEDocument:prSetTextMirror   0x4303858
        arg this = <instance of ScIDEDocument>
        arg quuid = nil
        arg text = "
var index, preferredDevices..."
        arg start = 0
        arg range = -1
    ScIDEDocument:prSetText   0x5a61298
        arg this = <instance of ScIDEDocument>
        arg text = "
var index, preferredDevices..."
        arg action = nil
        arg start = 0
        arg range = -1
        var funcID = nil
    ScIDEDocument:text_   0x43da1d8
        arg this = <instance of ScIDEDocument>
        arg string = "
var index, preferredDevices..."
    ScIDEDocument:prReadTextFromFile   0x1322778
        arg this = <instance of ScIDEDocument>
        arg path = "/home/dlm/share/SC/scd/simpl..."
        var file = <instance of File>
    ScIDEDocument:initFromPath   0x49ecc88
        arg this = <instance of ScIDEDocument>
        arg path = "/home/dlm/share/SC/scd/simpl..."
        arg selectionStart = 0
        arg selectionLength = 0
        var doc = nil
    Meta_Document:open   0x5412fa8
        arg this = <instance of Meta_Document>
        arg path = "~/share/SC/scd/simple-piano.scd"
        arg selectionStart = 0
        arg selectionLength = 0
        arg envir = nil
        var doc = nil
    String:openDocument   0x53e0568
        arg this = "~/share/SC/scd/simple-piano.scd"
        arg selectionStart = 0
        arg selectionLength = 0
        var ideClass = nil
    Interpreter:interpretPrintCmdLine   0x7f81d001e9d8
        arg this = <instance of Interpreter>
        var res = nil
        var func = <instance of Function>
        var code = ""~/share/SC/scd/simple-piano..."
        var doc = <instance of ScIDEDocument>
        var ideClass = <instance of Meta_ScIDE>
    Process:interpretPrintCmdLine   0x4922668
        arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Primitive '_ScIDE_SetDocTextMirror' failed.
Wrong type.
RECEIVER: a ScIDEDocument
@muellmusik
Copy link
Contributor

Hmm. I don't think this is the problem, but surely String:openDocument should not look like this:

    openDocument { arg selectionStart=0, selectionLength=0;
        var ideClass;
        if(Document.implementationClass.notNil) {
            Document.open(this, selectionStart, selectionLength);
            ^this
        };

        ideClass = \ScIDE.asClass;
        if ( ideClass.notNil ) {
            if ( this.endsWith(".sc") || this.endsWith(".scd") ) {
                ideClass.open(this, selectionStart, selectionLength);
                ^this
            }
        };

        this.openOS
    }

@jamshark70
Copy link
Contributor Author

On Tuesday, October 1, 2013 3:34:53 PM HKT, muellmusik wrote:

Hmm. I don't think this is the problem, but surely
String:openDocument should not look like this:

Maybe this as a patch, then? (Maybe not safe... it assumes that sclang doesn't compile the ScIDE classes if it's not running under the IDE.)

(Not sure if github will preserve the attachment...)

hjh

@muellmusik
Copy link
Contributor

No attachment I'm afraid. Can you paste it in?

@muellmusik
Copy link
Contributor

I think probably the second block should just be removed.

I can see where the problem is in general, btw. It doesn't have a quuid, and it needs one now with the new implementation. The joys of doing things twice...

On a broader note, the Document implementation subclass/redirect/clusterclass is a tangled and difficult to read mess in my opinion. It really doesn't need to be, especially now. But I'll leave that to some braver soul.

@jamshark70
Copy link
Contributor Author

Can't attach now, sorry. All I did was move the ScIDE if-block to come before the implementation class check. It did eliminate the error.

But you're right, this is still major hack territory. The String methods related to Document should be very simple and leave the details to the implementing classes.

I've already volunteered to look at Server refactoring so I'll pass on this one. (And I'm busy trying to finish an EP by early next year, so the Server stuff is stalled on my side...)

@muellmusik
Copy link
Contributor

No the ScIDE block should just be removed. Putting it first doesn't solve it, it just bypasses the doc implementation, which it should use as you say.

I know what needs to happen in the back end. It's not hard, but may take a little time to get to as it's start of term here. Nobody's asked you to deal with this, so don't worry, and happy EPing. :-)

@ghost ghost assigned muellmusik Oct 4, 2013
@muellmusik
Copy link
Contributor

Please test the fixOpenDocument branch. That should fix this. It also gets rid of the Document redirect for the IDE at least, which simplifies things.

@muellmusik
Copy link
Contributor

fixed in Pull Request #997: Fix open document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE
Projects
None yet
Development

No branches or pull requests

2 participants