raduprv / Eternal-Lands

http://www.eternal-lands.com
Other
158 stars 57 forks source link

Map editor crashes when selecting object #78

Closed gvissers closed 4 years ago

gvissers commented 4 years ago

With current git, linking the the map editor fails with a couple of issues:

Below patch fixes those problems:

diff --git a/map_editor/gui.c b/map_editor/gui.c
index 88f655cc..dd65c9d3 100644
--- a/map_editor/gui.c
+++ b/map_editor/gui.c
@@ -18,7 +18,6 @@ char obj_2d_folder[256];
 char obj_3d_folder[256];
 char particles_folder[256];

-char * selected_file = NULL;
 GtkWidget * gtk_open_win = NULL;
 GtkWidget * gtk_save_win = NULL;
 GtkWidget * gtk_effect_win = NULL;
diff --git a/map_editor/tile_map.c b/map_editor/tile_map.c
index 7f72297b..e98431ee 100644
--- a/map_editor/tile_map.c
+++ b/map_editor/tile_map.c
@@ -4,6 +4,8 @@
 #include "global.h"
 #include "../asc.h"

+image_t map_tiles[256];
+
 void destroy_map_tiles()
 {
        int i;
diff --git a/map_editor/tiles.h b/map_editor/tiles.h
index 87c36761..7db00611 100644
--- a/map_editor/tiles.h
+++ b/map_editor/tiles.h
@@ -2,7 +2,7 @@
 #define __TILE_H__
 #include "../textures.h"

-image_t map_tiles[256];
+extern image_t map_tiles[256];

 extern unsigned char *tile_map;
 extern unsigned char *height_map;

And I can now run the map editor, open a map file, and add 2D and 3D objects. Adding ground tiles shows the wrong textures though, so I may have messed up something with the map_tiles in the above patch. Worst is when trying to select an object, then the editor crashes, with a stack trace like

Thread 1 "mapedit.x86.lin" received signal SIGSEGV, Segmentation fault.
0x00007fffed93a05b in LLVMBuildBitCast () from /usr/lib/libLLVM-10.so
(gdb) bt
#0  0x00007fffed93a05b in LLVMBuildBitCast () at /usr/lib/libLLVM-10.so
#1  0x00007ffff2bb2d7d in  () at /usr/lib/dri/iris_dri.so
#2  0x00007ffff2bb41e3 in  () at /usr/lib/dri/iris_dri.so
#3  0x00007ffff2bb514b in  () at /usr/lib/dri/iris_dri.so
#4  0x00007ffff2bd9f72 in  () at /usr/lib/dri/iris_dri.so
#5  0x00007ffff2c14f6b in  () at /usr/lib/dri/iris_dri.so
#6  0x00007ffff2c3b8c2 in  () at /usr/lib/dri/iris_dri.so
#7  0x00007ffff2c4c4b0 in  () at /usr/lib/dri/iris_dri.so
#8  0x00007ffff2c4ef76 in  () at /usr/lib/dri/iris_dri.so
#9  0x00007ffff30c16b3 in  () at /usr/lib/dri/iris_dri.so
#10 0x00007ffff2f3bf43 in  () at /usr/lib/dri/iris_dri.so
#11 0x00007ffff2f3c844 in  () at /usr/lib/dri/iris_dri.so
#12 0x00007ffff2f43f63 in  () at /usr/lib/dri/iris_dri.so
#13 0x00007ffff2ec81b9 in  () at /usr/lib/dri/iris_dri.so
#14 0x0000555555563a5c in draw_2d_object (object_id=0x55555753f220) at 2d_objects.c:156
#15 0x00005555555805be in get_2d_object_under_mouse () at misc.c:363
#16 0x0000555555571d3b in HandleEvent (event=0x7fffffffddc0) at events.c:790
#17 0x000055555557ce26 in start_rendering () at main.c:19
#18 0x000055555557cf77 in Main (argc=1, argv=0x7fffffffdf18) at main.c:72
#19 0x000055555557cf9e in main (argc=1, argv=0x7fffffffdf18) at main.c:80

Nothing obviously wrong jumps out to me at the offending line (nor for 3D objects), so atm I have no idea what causes this.

I'll try to investigate, but thought I'd put it out here as a warning, and to see if other people experience the same problem.

UPDATE: the crash may be driver related, as it doesn't occur when I force software rendering using LIBGL_ALWAYS_SOFTWARE=1.

gvissers commented 4 years ago

Okay, using software rendering the thing seems to work, so closing this issue for now. If someone else experiences the same problem, please reopen.