Bug #814
closedCrash S3_2 freeciv-gtk3.22 government.c:402 pplayer->government null pointer
0%
Description
$ git rev-parse --abbrev-ref HEAD
S3_2
$ git rev-parse HEAD
70e789f21985253fa8df3f3da57f7ada6e82109d
Can repeat:
Start freeciv-gtk3.22
Load savegame (attachment)
Start
Turn Done
Crash
$ opt/freeciv/bin/freeciv-gtk3.22
3: Loading tileset "hexemplio".
3: last message repeated 2 times
3: last message repeated 2 times (total 4 repeats)
Segmentation fault (core dumped)
(gdb) bt full
#0 0x0000590fe95f8fa2 in ruler_title_for_player (pplayer=0x590fedc4d390, buf=0x7fff4809ca10 "Tribune Lucius Cornelius Sulla", buf_len=192) at government.c:402
pgovern = 0x0
pnation = 0x590fef357478
pruler_title = 0x7fff4809c900
FUNCTION = "ruler_title_for_player"
#1 0x0000590fe952a445 in create_diplomacy_dialog (ptreaty=0x590ff47b87a0, plr0=0x590fef912800, plr1=0x590fedc4d390) at diplodlg.c:871
dipl_dialog = 0x590feddee9a0
vbox = 0x590ff48489c0
hbox = 0x590ff484a690
table = 0x590ff4843580
mainbox = 0x590ff482f110
label = 0x590ff484aee0
sw = 0x590fe970b3f3 <fc_real_malloc+35>
view = 0x716faf267ef0 <g_io_unix_dispatch>
image = 0x590ff484aab0
spin = 0x590ff4843b00
menubar = 0x590ff4840e60
menuitem = 0x590ff4842470
menu = 0x590ff48411c0
notebook = 0x590ff47b76f0
flag_spr = 0x590ff3ab8910
store = 0x9
rend = 0x7fff4809ca40
i = 1
pdialog = 0x590ff47b68b0
plr_buf = "Tribune Lucius Cornelius Sulla\000\000P\312\tH\377\177\000\000\320\355\036\357\017Y\000\000\200s/\257oq\000\000\360~&\257oq\000\000\220\312\tH\377\177\000\000\000\316Ֆi\342c\322\300\337y\351\017Y\000\000\320\355\036\357\017Y\000\000\200s/\257oq\000\000\360~&\257oq\000\000\300\312\tH\377\177\000\000\363\263p\351\017Y\000\000\300\337y\351\017Y\000\000\000\316ՖK\000\000\000\321\337y\351\017Y\000\000\030\000\000\000\000\000\000\000\020\316\343\355\017Y\000\000\360\312\tH\377\177\000\000\235\266R\351\017Y\000\000\220\323\304\355\017Y\000"
buf = 0x590ff4847030 "\207\352{d\nY"
#2 0x0000590fe9527ee5 in popup_diplomacy_dialog (ptreaty=0x590ff47b87a0, they=0x590fedc4d390, initiator=0x590fedc4d390) at diplodlg.c:215
pdialog = 0x0
FUNCTION = "popup_diplomacy_dialog"
#3 0x0000590fe9527cbc in gui_init_meeting (ptreaty=0x590ff47b87a0, they=0x590fedc4d390, initiator=0x590fedc4d390) at diplodlg.c:140
No locals.
#4 0x0000590fe95a169b in client_init_meeting (counterpart=3, initiated_from=3) at clitreaty.c:53
ptreaty = 0x590ff47b87a0
we = 0x590fef912800
they = 0x590fedc4d390
#5 0x0000590fe94ced46 in handle_diplomacy_init_meeting (counterpart=3, initiated_from=3) at packhand.c:5546
No locals.
#6 0x0000590fe94cf482 in client_handle_packet (type=PACKET_DIPLOMACY_INIT_MEETING, packet=0x590ff0cb8f10) at packhand_gen.c:230
No locals.
#7 0x0000590fe94919e0 in client_packet_input (packet=0x590ff0cb8f10, type=96) at client_main.c:789
FUNCTION = "client_packet_input"
#8 0x0000590fe94996e4 in input_from_server (fd=13) at clinet.c:425
type = PACKET_DIPLOMACY_INIT_MEETING
packet = 0x590ff0cb8f10
nb = 12063
FUNCTION = "input_from_server"
#9 0x0000590fe948efad in get_net_input (source=0x590fede8cc20, condition=G_IO_IN, data=0x0) at gui_main.c:2283
No locals.
#10 0x0000716faf207299 in g_main_dispatch (context=0x590fed407420) at ../glib/glib/gmain.c:3344
dispatch = 0x716faf267ef0 <g_io_unix_dispatch>
prev_source = 0x0
begin_time_nsec = 133474866163962
was_in_call = 0
user_data = 0x0
callback = 0x590fe948ef87 <get_net_input>
cb_funcs = 0x716faf2f7380 <g_source_callback_funcs>
cb_data = 0x590fef189050
need_destroy = <optimized out>
source = 0x590fef1eedd0
current = 0x590fed4075d0
i = 1
func = "g_main_dispatch"
#11 0x0000716faf269ec7 in g_main_context_dispatch_unlocked (context=0x590fed407420) at ../glib/glib/gmain.c:4152
No locals.
#12 g_main_context_iterate_unlocked.isra.0 (context=0x590fed407420, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4217
max_priority = 125
timeout = 0
some_ready = 1
nfds = 4
allocated_nfds = <optimized out>
fds = 0x590fed7c62d0
begin_time_nsec = 133474866146941
#13 0x0000716faf207fa7 in g_main_loop_run (loop=0x590fef173fd0) at ../glib/glib/gmain.c:4419
--Type <RET> for more, q to quit, c to continue without paging--c
self = <optimized out>
func = "g_main_loop_run"
#14 0x0000716faf9e390f in gtk_main () at ../gtk/gtk/gtkmain.c:1329
loop = 0x590fef173fd0
#15 0x0000590fe948e9ad in ui_main (argc=1, argv=0x7fff4809d628) at gui_main.c:2048
window_name = "Freeciv (gtk3.22)\000ackground0\000ble0\000\000t0\0000\000\300\004<\355\017Y\000\000\005\022\000\000\000\000\000\000\210\377\377\377\377\377\377\377\002\000\000\000\000\000\000\000\260\177(\355\017Y\000\000\320\316\tH\377\177\000\000\316\365\377\256oq\000\000\002\000\000\000\000\000\000\000\210\377\377\377\377\377\377\377\002\000\000\000\000\000\000\000\020\200(\355\017Y\000\000\000\317\tH\377\177\000\000\316\365\377\256oq\000\000\000\317\tH\377\177\000\000/\205q\351\017Y\000\000\001\000\000\000\000\000\000\000\210\377\377\377\377\377\377\377\002\000\000\000\000\000\000\000\300\226$\355\017Y\000\000@\317\tH\377\177\000\000"...
toplevel_font_name = 0x590fed5d16d0
sig = 73
FUNCTION = "ui_main"
#16 0x0000590fe94916e8 in client_main (argc=1, argv=0x7fff4809d628, postpone_tileset=false) at client_main.c:699
i = 1
loglevel = LOG_NORMAL
ui_options = 0
ui_separator = false
option = 0x0
fatal_assertions = -1
aii = 2
uret = 22799
#17 0x0000590fe948dd7d in main (argc=1, argv=0x7fff4809d628) at gui_main.c:1790
No locals.
(gdb) p *pplayer
$3 = {slot = 0x590fef2bba88, name = "Crescencio Poot", '\000' <repeats 32 times>, username = "Unassigned", '\000' <repeats 37 times>, unassigned_user = true, ranked_username = "Unassigned", '\000' <repeats 37 times>, unassigned_ranked = true,
user_turns = 0, is_male = true, government = 0x0, target_government = 0x0, nation = 0x590fef357478, team = 0x590feeb9bd10, is_ready = false, phase_done = false, ai_phase_done = false, nturns_idle = 265, turns_alive = 265, is_alive = true,
is_winner = false, last_war_action = -1, revolution_finishes = -1, primary_capital_id = 198, real_embassy = {vec = "\001", '\000' <repeats 62 times>}, diplstates = 0x590ff62bd3e0, style = 0x590fed53f1f0, music_style = -1, cities = 0x590ff4deb950,
units = 0x590ff5ba56e0, score = {happy = 0, content = 0, unhappy = 0, angry = 0, specialists = {0 <repeats 20 times>}, wonders = 0, techs = 0, techout = 0, landarea = 0, settledarea = 0, population = 0, cities = 0, units = 0, pollution = 0,
literacy = 0, bnp = 0, mfg = 0, spaceship = 0, units_built = 0, units_killed = 0, units_lost = 0, units_used = 0, culture = 0, game = -1}, economic = {gold = 0, tax = 0, science = 0, luxury = 0, infra_points = 0}, spaceship = {structurals = 0,
components = 0, modules = 0, structure = {vec = "\000\000\000"}, fuel = 0, propulsion = 0, habitation = 0, life_support = 0, solar_panels = 0, state = SSHIP_NONE, launch_year = 9999, population = 0, mass = 0, support_rate = 0, energy_rate = 0,
success_rate = 0, travel_time = 0}, ai_common = {maxbuycost = 0, handicaps = 0x0, skill_level = AI_LEVEL_CHEATING, fuzzy = 0, expand = 100, science_cost = 100, warmth = 0, frost = 0, barbarian_type = NOT_A_BARBARIAN, love = {-3, 1000, -59, 0, 967,
-41, -13, 1000, -92, 766, 987, -41, 0, 88, 1 <repeats 498 times>}, traits = 0x0}, ai = 0x0, savegame_ai_type_name = 0x0, flags = {vec = "\005"}, was_created = false, random_name = true, is_connected = false, current_conn = 0x0,
connections = 0x590feeb9bcc0, autoselect_weight = 0, gives_shared_vision = {vec = '\000' <repeats 63 times>}, gives_shared_tiles = {vec = '\000' <repeats 63 times>}, wonders = {0 <repeats 23 times>, 198, 0 <repeats 176 times>}, attribute_block = {
data = 0x0, length = 0}, attribute_block_buffer = {data = 0x0, length = 0}, tile_known = {bits = 1, vec = 0x590fef27cf00 ""}, rgb = 0x590feeb9bd30, multipliers = {{value = 0, target = 0, changed = 0} <repeats 50 times>}, history = 0, {server = {
status = {vec = "\001"}, private_map = 0x590fed7c6160, border_vision = true, really_gives_vision = {
vec = "\000\000\000\000\000\000\0000U|\356\017Y\000\000\001\000\000\000\000\000\000\000\200r\274\355\017Y\000\000\000\000\000\000\000\000\000\000\001", '\000' <repeats 23 times>}, debug = {vec = ""}, adv = 0x0, ais = {0x0, 0x0},
delegate_to = '\000' <repeats 47 times>, orig_username = '\000' <repeats 47 times>, huts = 0, bulbs_last_turn = 0}, client = {tile_vision = {{bits = 1, vec = 0x590fed7c6160 ""}, {bits = 1, vec = 0x590fee7c5530 ""}, {bits = 1,
vec = 0x590fedbc7280 ""}}, mood = MOOD_PEACEFUL, tech_upkeep = 0, color_changeable = true, culture = 0}}}
(gdb)
pplayer.government = 0x0
struct government *government_of_player(const struct player *pplayer)
{
fc_assert_ret_val(NULL != pplayer, NULL);
return pplayer->government;
}
const char *ruler_title_for_player(const struct player *pplayer,
char *buf, size_t buf_len)
{
const struct government *pgovern = government_of_player(pplayer);
const struct nation_type *pnation = nation_of_player(pplayer);
struct ruler_title *pruler_title;
fc_assert_ret_val(NULL != buf, NULL);
fc_assert_ret_val(0 < buf_len, NULL);
/* Try specific nation ruler title. */
if (!ruler_title_hash_lookup(pgovern->ruler_titles,
Files