Segfault when typing in a TextBox (Avalonia 11 only)
See original GitHub issueDescribe the bug Typing anything in a text box produces a segmentation fault. It happens on Avalonia 11 only (release / RC2 / RC1), not an issue on previous Avalonia versions.
To reproduce
- Create a minimal Avalonia 11 project (see avalonia11-textbox-segfault.zip)
- Compile it (debug / release, it doesn’t matter) and run the resulting binary
- Type something in the text box
- Nothing happens, the program freezes for a second and then segfaults
Expected behavior The text box works as before in Avalonia 0.10, the text is displayed in the text box as typed, no segfault.
Screenshots
Platform / Versions:
- Distro:
Arch Linux
- Kernel:
Linux 6.4.1-arch2-1 #1 SMP PREEMPT_DYNAMIC Tue, 04 Jul 2023 08:39:40 +0000 x86_64 GNU/Linux
- Avalonia:
Avalonia 11.0.0
(happens with RC2 and RC1 too)
Additional context I just ported a lot of code from Avalonia 0.10 to Avalonia 11, everything went well, except the aforementioned issue, because of which the porting changes had to be reverted (so back to Avalonia 0.10 for the moment).
Coredump info
PID: 75155 (AvaloniaApplica)
UID: 1000 (luc)
GID: 984 (users)
Signal: 11 (SEGV)
Timestamp: Wed 2023-07-05 16:31:15 EEST (53s ago)
Command Line: ./AvaloniaApplication1
Executable: /home/luc/work/local/priv/test/AvaloniaApplication1/AvaloniaApplication1/bin/Debug/net7.0/AvaloniaApplication1
Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.krusader-e3fd96ebaf274139877d3c45a337602b.scope
Unit: user@1000.service
User Unit: app-org.kde.krusader-e3fd96ebaf274139877d3c45a337602b.scope
Slice: user-1000.slice
Owner UID: 1000 (luc)
Boot ID: 2d88b41373eb4c939484ea0f6639dc2a
Machine ID: 7ef120f7400d4e32b31e544f08d6ddf2
Hostname: luc
Storage: /var/lib/systemd/coredump/core.AvaloniaApplica.1000.2d88b41373eb4c939484ea0f6639dc2a.75155.1688563875000000.zst (present)
Size on Disk: 13.6M
Message: Process 75155 (AvaloniaApplica) of user 1000 dumped core.
Stack trace of thread 75155:
#0 0x00007f5dca97c004 Xutf8LookupString (libX11.so.6 + 0x4f004)
#1 0x00007f5d5cc13721 n/a (n/a + 0x0)
#2 0x00007f5d5cc13561 n/a (n/a + 0x0)
#3 0x00007f5d5cc10ac3 n/a (n/a + 0x0)
#4 0x00007f5d5c9c45fd n/a (n/a + 0x0)
#5 0x00007f5d5cc063e8 n/a (n/a + 0x0)
#6 0x00007f5d5c9a40e2 n/a (n/a + 0x0)
#7 0x00007f5d5c9a3879 n/a (n/a + 0x0)
#8 0x00007f5d5c9a3429 n/a (n/a + 0x0)
#9 0x00007f5d5c9a310f n/a (n/a + 0x0)
#10 0x00007f5d5c527140 n/a (n/a + 0x0)
#11 0x00007f5d5b0a2443 n/a (n/a + 0x0)
#12 0x00007f5d5b0a0acd n/a (n/a + 0x0)
#13 0x00007f5dd97643e7 n/a (libcoreclr.so + 0x3643e7)
#14 0x00007f5dd959bec4 n/a (libcoreclr.so + 0x19bec4)
#15 0x00007f5dd9486254 n/a (libcoreclr.so + 0x86254)
#16 0x00007f5dd948659a n/a (libcoreclr.so + 0x8659a)
#17 0x00007f5dd94b2265 n/a (libcoreclr.so + 0xb2265)
#18 0x00007f5dd9473317 coreclr_execute_assembly (libcoreclr.so + 0x73317)
#19 0x00007f5dda0a9156 n/a (libhostpolicy.so + 0x15156)
#20 0x00007f5dda0a943e n/a (libhostpolicy.so + 0x1543e)
#21 0x00007f5dda0a9d96 corehost_main (libhostpolicy.so + 0x15d96)
#22 0x00007f5dda0f072b n/a (libhostfxr.so + 0x1072b)
#23 0x00007f5dda0ef74c n/a (libhostfxr.so + 0xf74c)
#24 0x00007f5dda0ebf78 hostfxr_main_startupinfo (libhostfxr.so + 0xbf78)
#25 0x000055df0a2c927b n/a (/home/luc/work/local/priv/test/AvaloniaApplication1/AvaloniaApplication1/bin/Debug/net7.0/AvaloniaApplication1 + 0xd27b)
#26 0x000055df0a2c951f n/a (/home/luc/work/local/priv/test/AvaloniaApplication1/AvaloniaApplication1/bin/Debug/net7.0/AvaloniaApplication1 + 0xd51f)
#27 0x00007f5dd9b4c850 n/a (libc.so.6 + 0x23850)
#28 0x00007f5dd9b4c90a __libc_start_main (libc.so.6 + 0x2390a)
#29 0x000055df0a2bf6c5 n/a (/home/luc/work/local/priv/test/AvaloniaApplication1/AvaloniaApplication1/bin/Debug/net7.0/AvaloniaApplication1 + 0x36c5)
ELF object binary architecture: AMD x86-64
---
#0 Xutf8LookupString (ic=0x0, ev=0x7ffc99255700, buffer=0x55df0d4d9370 "\240S\320\331]\177", nbytes=65536, keysym=0x7ffc99255140, status=0x7ffc99255158) at xlibi18n/ICWrap.c:424
420 int
421 Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes,
422 KeySym *keysym, Status *status)
423 {
>424 if (ic->core.im) {
425 if (ic->methods->utf8_lookup_string)
426 return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes,
427 keysym, status);
428 else if (ic->methods->mb_lookup_string)
429 return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
430 keysym, status);
431 }
432 return XLookupNone;
433 }
Issue Analytics
- State:
- Created 3 months ago
- Comments:29 (29 by maintainers)
Top Results From Across the Web
Newest 'avaloniaui' Questions - Page 6
I'm trying out styles in avalonia and most works, except for pseudoclasses, they just get ignored. I have created a window and all...
Read more >Overriding Sealed Methods in C# - InfoQ
In this article, the author demonstrates how we can change the behavior of sealed methods in C#. This can be done by understanding...
Read more >Newest 'visual-studio' Questions - Page 265
Lets say I have classes like the following: public class Input<T> { // some data here but type T is never directly used...
Read more >开源项目 - 林德熙
XamlFlair/XamlFlair: XamlFlair is an animation library for UWP, WPF, and Uno, built to facilitate Xaml animations using only attached properties. WPFTOOLS.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, thank you for all your time spent on this.
Until it is fixed upstream, I’m going to use the following patch so I can use Avalonia 11 in my projects. Please be so kind and take a (final) quick glance over it and let me know if you think something looks fishy to your trained eye.
I tested it on all my 5 computers, and everything works as expected: no more segfaults and UTF-8 multi-byte chars are properly translated.
Thanks again, Luc
Done, see https://github.com/AvaloniaUI/Avalonia/pull/12313. I hope it is usable on your side with little effort, I changed it a bit by trying to match Avalonia’s coding style (which - sadly - doesn’t place single-line if statements inside braces).
Thank you again for all your support.