[hatari-devel] Hatari crash with --cmd-fifo |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: Eero Tamminen <oak@xxxxxxxxxxxxxx>
- Subject: [hatari-devel] Hatari crash with --cmd-fifo
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sun, 18 May 2025 09:37:21 +0000
- Cc: Hatari Development <hatari-devel@xxxxxxxxxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1747561046; bh=XINYc7ga24XQD1gIyCWfsm7sk/FjzNhaLT/4E8JcVoQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=ceFg5JnLwzYlv0Hdn/Un2NnBReEJDqQLR9ENymjQBAYFLU2TWlQtCh5B0u04KeauA /MO1U/GyhIidSvCNXe00cMEXNpIdxA7x8aS5oKPYW9qO1e6XbVvTcCRBgZxzBSmu5C m75dsC15L0mdTcLkFQxUCyWOthqaQqXUSVKLJPGk9ybPSV3OZ1Q1haE2TzN6nnYpKP yKIh6YFNZ/PYKcYKM1bFIrKutknOOr4a9We5c36E451/waV1IEnzNg38o1hw/OVUVx bkmjNHFwjrQWipv6aWXFzg6fz+3JckmE4cspzKhC1SayobFvwdegGXmfAAnzxK3YMO HorHoyiGCEM9A==
Hi Eero,
I recently noticed that the cmdfifo test sometimes fails:
https://framagit.org/hatari/hatari/-/jobs/2860221#L1550
I can reproduce the problem easily by replacing the "sleep 0.1" with "sleep
0.01" in tests/cmdfifo.sh, so I was able to finally get a call trace with
gdb:
Thread 1 "hatari" received signal SIGSEGV, Segmentation fault.
ScreenSnapShot_SavePNG_ToFile (surface=surface@entry=0x0, dw=dw@entry=0, dh=dh@entry=0,
fp=fp@entry=0x168a5c0, png_compression_level=png_compression_level@entry=-1,
png_filter=png_filter@entry=-1, CropLeft=0, CropRight=0, CropTop=0, CropBottom=0)
at .../src/screenSnapShot.c:114
114 int sw = surface->w - CropLeft - CropRight;
#0 ScreenSnapShot_SavePNG_ToFile (surface=surface@entry=0x0, dw=dw@entry=0, dh=dh@entry=0,
fp=fp@entry=0x168a5c0, png_compression_level=png_compression_level@entry=-1,
png_filter=png_filter@entry=-1, CropLeft=0, CropRight=0, CropTop=0, CropBottom=0)
at .../src/screenSnapShot.c:114
#1 0x0000000000442c01 in ScreenSnapShot_SavePNG (surface=0x0,
filename=filename@entry=0x16c3d80 "/tmp/tmp.91fmptJ1Iu/grab0001.png")
at .../src/screenSnapShot.c:96
#2 0x0000000000442e74 in ScreenSnapShot_SaveScreen ()
at .../src/screenSnapShot.c:564
#3 0x00000000004432e4 in ShortCut_ActKey ()
at .../src/shortcut.c:317
#4 0x00000000004436a1 in Shortcut_Invoke (shortcut=shortcut@entry=0x168c5bb "screenshot")
at .../src/shortcut.c:411
#5 0x000000000040c71f in Control_ProcessBuffer (
orig=orig@entry=0x7fffffffca40 "hatari-debug r\nhatari-path memsave /tmp/tmp.91fmptJ1Iu/testmem.sav\nhatari-shortcut savemem\nhatari-shortcut screenshot\nhatari-shortcut recsound\nhatari-shortcut recanim\nhatari-option --spec512 256\nhatar"...)
at .../src/control.c:346
#6 0x000000000040ce71 in Control_CheckUpdates ()
at .../src/control.c:425
#7 0x000000000042f416 in Main_Init () at .../src/main.c:810
#8 main (argc=11, argv=0x7fffffffdc18) at .../src/main.c:1030
The problem is that in Main_Init(), Control_CheckUpdates() is called before
Screen_Init(), so taking a screenshot via the fifo command fails badly.
No clue how to best fix this, though. We could of course skip the
SaveScreen if the surface has not been initialized yet, but I'm a little
bit afraid that this only papers over the real problem. I think the command
fifo should only be taken into consideration once Hatar has properly
been initialized. But lLooking at the comment there, the Control_CheckUpdates()
has been added for enabling window embedding? Could that maybe be done in a
different way, e.g. via a command line option instead?
Thomas