New MUC does not show up in Chats list
It seems there's double-free caused by g_autofree for "history_since" chat attribute
(gdb) bt
#0 0x00007f9005c2a4a2 in free () at /usr/lib/libc.so.6
#1 0x00007f9006d5342f in () at /usr/lib/libglib-2.0.so.0
#2 0x00007f9006d546a8 in g_hash_table_remove_all () at /usr/lib/libglib-2.0.so.0
#3 0x00007f9006d546ef in g_hash_table_destroy () at /usr/lib/libglib-2.0.so.0
#4 0x00007f90062536ce in purple_chat_destroy () at /usr/lib/libpurple.so.0
#5 0x000056478b1e102c in chatty_blist_chat_list_remove_buddy () at ../src/chatty-buddy-list.c:1008
#6 0x000056478b1ed218 in view_msg_list_cmd_delete (action=0x56478c6338a0, parameter=0x0, user_data=0x56478c6002b0) at ../src/chatty-popover-actions.c:55
0x7f9006d53428: mov %r8,0x18(%rsp)
0x7f9006d5342d: callq *%rdx
=> 0x7f9006d5342f: mov 0x18(%rsp),%r8
r8 0x56478cab3e10 94865302699536
gdb) x/s 0x56478cab3e10
0x56478cab3e10: "1970-01-01T00:00:01Z"
Suspected code:
void
chatty_conv_add_history_since_component (GHashTable *components,
const char *account,
const char *room){
time_t mtime;
struct tm * timeinfo;
g_autofree gchar *iso_timestamp = g_malloc0(MAX_GMT_ISO_SIZE * sizeof(char));
mtime = chatty_history_get_chat_last_message_time(account, room);
mtime += 1; // Use the next epoch to exclude the last stored message(s)
timeinfo = gmtime (&mtime);
g_return_if_fail (strftime (iso_timestamp,
MAX_GMT_ISO_SIZE * sizeof(char),
"%Y-%m-%dT%H:%M:%SZ",
timeinfo));
g_hash_table_steal (components, "history_since");
g_hash_table_insert (components, "history_since", g_steal_pointer(&iso_timestamp));
}
Edited by Andrea Schaefer