-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
More segmentation faults #87
Comments
Thanks. Do you care for a patch, so your name will be in the git log? |
I've fixed I'm not sure if this is the right way to go or not. |
No, you changed self cmp value to NIL cmp value. |
That's fine - I can do the check for Lobby. The problem is, that this is called for any user objects that don't explicitly implement
needs to be defined as well. We can't compare the pointers by default, as this could result in the comparison changing after a garbage collection (well, we could if you don't mind the value being essentially random). I'm not saying the way I did it is the right way, just that we need to make the comparison work for more than just Lobby. Either that, or we need to override the method in Object, which amounts to the same thing. |
See GH #87. Fixes Function()() (empty closure or method), Error() (empty error message), Lobby cmp 0 (compare with Lobby is always 1, unless with Lobby which is 0). string of Compiled() (proto_string) not yet fixed
I see. A missing cmp method should rather error I believe. |
The error with if (e->message == PN_NIL)
return potion_str_format(P, "** unspecified error"); into This has the advantage that we can create our own I also added a constructor for My plan is to change Let me know if I'm on the right path with this, as I don't want to waste time, if it's not the right solution. |
Sounds good. |
Remove the possibility for the user to create a "special" object that doesn't have a constructor. Disable subclassing any of the "special" types built-in to the system.
See GH #87. Fixes Function()() (empty closure or method), Error() (empty error message), Lobby cmp 0 (compare with Lobby is always 1, unless with Lobby which is 0). string of Compiled() (proto_string) not yet fixed
See GH #87. Fixes Function()() (empty closure or method), Error() (empty error message), Lobby cmp 0 (compare with Lobby is always 1, unless with Lobby which is 0). string of Compiled() (proto_string) not yet fixed
The following lines each result in a segfault
This can be fixed by a check in potion_call that the closure and closure->method is not null and returning PN_NIL if either are null. You might also want to output a warning that the method was null.
This is caused by the REPL trying to print the error object by converting to string, where the message is set to null. The offending call to
potion_str_ptr
being inpotion_error_string
.Again this is caused by the REPL trying to print out the value. The problem occurs in
potion_proto_string
about 9 lines in, on thepn_printf
statement.The last two errors only occur in the REPL, and don't cause a problem unless they are called or converted to string, when the lack of data in the structs becomes a problem.
Possibly for Error, it would be nice to have a constructor that took a string and returned a valid Error object, but I can't see any reason why the Compiled constructor should be exposed at all.
This is caused by an infinite loop in
potion_any_cmp
, where there should probably be a check for lobby and if so, directly return a value.The text was updated successfully, but these errors were encountered: