Crash after autocompliting with posix profile and GLib
Describe the bug Crash after autocompliting with posix profile
Software
OS and version (e.g. Ubuntu 20.04): Arch
Code editor (e.g. VSCode): VSCode
Vala Language Server (e.g. git commit, or PPA/AUR version): master
Vala version (valac --version): 0.50
To Reproduce
Source code repo: any code with add_global_arguments('--profile=posix', language:'vala') in meson
Steps to reproduce the behavior:
- Open vala file after
meson build --reconfigurecommand, first auto-complite mkdir worked, than crash.
Crash log(there was 2 of them) https://pastebin.com/fvHFW9Us
This part shows every time after open file
https://pastebin.com/JRYLADHJ
Hmm...seems to work for me:
% ls -lt
total 8
-rw-r--r-- 1 pferro pferro 105 Feb 17 16:00 thing.vala
-rw-r--r-- 1 pferro pferro 137 Feb 17 15:59 meson.build
meson.build:
project('test', 'vala', 'c')
add_global_arguments('--profile=posix', language: 'vala')
executable('thing',
sources: ['thing.vala'])
thing.vala:
using Posix;
void main() {
exit(EXIT_SUCCESS);
}
https://user-images.githubusercontent.com/30507409/108271739-50c97800-7182-11eb-863f-f1f871ac304a.mp4
Hmm, just recompiled from cloned master, it reproducible.
@gavr123456789 If you remove the [Compact]class Sas {} from your code does that now work?
Removing the GType runtime type system, like you're doing, is going to cause problems with any assumptions made by the type system.
Your code:
[Compact]
class Sas {
public int a;
}
void func (Sas sas) {
}
void main () {
}
can be compiled to C with:
valac --profile=posix test.vala --ccode
but the generated C code doesn't declare the Sas type, so the C compiler won't compile it. Compiling Vala code that doesn't target the GType system is still a work in progress.
@gavr123456789 I do notice that I get these messages:
(vala-language-server:249867): vala-CRITICAL **: 14:51:38.065: vala_source_reference_to_string: assertion 'self != NULL' failed
But no crash. Do you have Vls: Fail on Criticals enabled?
I understand what the problem is!
I still had the glib packages enabled in meson.
In the video, you can see how 2k problems appear.
So, if you have both dependency('glib-2.0'), and add_global_arguments('--profile=posix', language:'vala') then vls crashes.
So, if you have both
dependency('glib-2.0'),andadd_global_arguments('--profile=posix', language:'vala')then vls crashes.
Even with this change, I still can't reproduce this issue.
Hmm, now it doesnt crashes, but works really slow and non stop spawn this criticals and errors.
...
Found that, try with dependency ('gtk4', version: '>= 4.0.0'),
https://user-images.githubusercontent.com/30507409/109360957-1e61fe00-7899-11eb-95dc-6f61f2c7b48c.mp4
So then should I close this?
Isnt that still a problem? Can you reproduce it with gtk 4 dep?
Yeah, I've been able to reproduce this actually.
It honestly seems like this is an issue in upstream, as I'm getting errors deep in libvala. However this is also a very unusual configuration that's impractical (no one is going to use GLib with a Posix profile).