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

pSrc not initialized in load_png #17

Closed
charlesdaniels opened this issue Jun 8, 2019 · 0 comments
Closed

pSrc not initialized in load_png #17

charlesdaniels opened this issue Jun 8, 2019 · 0 comments

Comments

@charlesdaniels
Copy link

Current as of 0729b31. I think this was introduced in 631e60f.

pSrc is initialized here, but never gets updated in the branch of PNG_COLOR_TYPE_RGB, which causes segfaults like this one:

Thread 1 "graph_editor" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b6f857 in ag_surface_get64_at (S=0x555556104170, p=0xff0000 <error: Cannot access memory at address 0xff0000>) at ./inline_surface.h:468
468                     return (*(Uint32 *)p);
(gdb) bt
#0  0x00007ffff7b6f857 in ag_surface_get64_at (S=0x555556104170, p=0xff0000 <error: Cannot access memory at address 0xff0000>) at ./inline_surface.h:468
#1  0x00007ffff7b7a757 in AG_SurfaceExportPNG (S=0x555556104170,
    path=0x555556092370 "/home/cad/src/teaching-learning/libraries/libagar/graph_editor/adsf.png", flags=0) at load_png.c:445
#2  0x0000555555555ba5 in ExportGraph (event=0x7fffffffced0) at main.c:197
#3  0x00007ffff7862fd2 in AG_PostEvent (sp=0x0, rp=0x555555df3b40, evname=0x7ffff7bb04be "file-chosen", fmt=0x7ffff7bb04b8 "%s,%p") at event.c:412
#4  0x00007ffff7b3cdfb in ChooseFile (fd=0x555555df3b40, pwin=0x555555def870) at file_dlg.c:344
#5  0x00007ffff7b3cb12 in CheckAccessAndChoose (fd=0x555555df3b40) at file_dlg.c:463
#6  0x00007ffff7b38f97 in PressedOK (event=0x7fffffffd6a0) at file_dlg.c:540
#7  0x00007ffff7862fd2 in AG_PostEvent (sp=0x0, rp=0x555555e4f520, evname=0x7ffff7bac61c "button-pushed", fmt=0x7ffff7bacfe1 "%i") at event.c:412
#8  0x00007ffff7aff201 in MouseButtonUp (event=0x7fffffffde10) at button.c:213
#9  0x00007ffff7862fd2 in AG_PostEvent (sp=0x0, rp=0x555555e4f520, evname=0x7ffff7b860d3 "mouse-button-up", fmt=0x7ffff7bb3911 "%i(button),%i(x),%i(y)")
    at event.c:412
#10 0x00007ffff7b761b6 in PostMouseButtonUp (win=0x555555def870, wid=0x555555e4f520, x=73, y=330, button=AG_MOUSE_LEFT) at mouse.c:207
#11 0x00007ffff7b761ec in PostMouseButtonUp (win=0x555555def870, wid=0x555555df3b40, x=73, y=330, button=AG_MOUSE_LEFT) at mouse.c:215
#12 0x00007ffff7b760d6 in AG_ProcessMouseButtonUp (win=0x555555def870, x=73, y=330, button=AG_MOUSE_LEFT) at mouse.c:302
#13 0x00007ffff7ad1386 in GLX_ProcessEvent (drvCaller=0x0, dev=0x7fffffffe288) at drv_glx.c:784
#14 0x00007ffff7ad454d in GLX_EventSink (es=0x55555576c7c0, event=0x55555576c7e0) at drv_glx.c:2063
#15 0x00007ffff78694e1 in AG_EventSinkTIMERFD () at event.c:1367
#16 0x00007ffff7869cfb in AG_EventLoop () at event.c:1624
#17 0x0000555555556360 in main (argc=1, argv=0x7fffffffe6b8) at main.c:370

I believe the solution is to replicate the initialization from here. I will try this out and see if I can get it fixed.

Also, I think that the BMP file saving logic is affected similarly. JPEG seems to have some other problem I haven't looked into yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants