August 6, 2018
Fix some issue
#18 Fix crash when users serach last 3 days log
bug tracker
Thread 1 "gnome-logs" received signal SIGSEGV, Segmentation fault.
0x00007ffff595f5b4 in g_date_time_to_unix () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff595f5b4 in g_date_time_to_unix () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x000055555555ea7c in query_set_day_timestamps (query=0x555556772ce0, start_day_offset=<optimized out>, end_day_offset=<optimized out>) at src/gl-eventviewlist.c:710
#2 0x000055555555f52f in query_add_journal_range_filter (view=0x5555559f71c0, query=0x555556772ce0)
at src/gl-eventviewlist.c:771
#3 0x000055555555f52f in create_query_object (view=view@entry=0x5555559f71c0) at src/gl-eventviewlist.c:816
#4 0x000055555555f843 in search_popover_journal_timestamp_range_changed (popover=<optimized out>, psec=<optimized out>, view=0x5555559f71c0) at src/gl-eventviewlist.c:991
#5 0x00007ffff5c50065 in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff5c627b2 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x00007ffff5c6b40c in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8 0x00007ffff5c6b7ef in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007ffff5c546a4 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
frame 1
(gdb) f 1
#1 0x000055555555ea7c in query_set_day_timestamps (query=0x555556772ce0, start_day_offset=<optimized out>,
end_day_offset=<optimized out>) at src/gl-eventviewlist.c:710
710 end_timestamp = g_date_time_to_unix (today_end) * G_USEC_PER_SEC;
(gdb) p today_end
$1 = (GDateTime *) 0x0
so here find a NULL,
so g_date_time_get_day_of_month (now) - end_day_offset
is A negative number, so the function g_date_time_to_unix will get a NULL, obviously , if I select last 3 days, It will get a Segmentation fault!
so should calculate, the end_day_offset should be consideration.
now = g_date_time_add_days (now, -start_day_offset);
use that to consider off_set in advanced !.
Here is my diff https://gitlab.gnome.org/GNOME/gnome-logs/merge_requests/7/diffsabout that issue!
#19 By clicking New Window in the application menu ,a segment fault will take place
Firstly run G_DEBUG=fatal-criticals gdb ./gnome-logs and see where exactly it fails.
(gnome-logs:1270): Gtk-CRITICAL **: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
Thread 1 "gnome-logs" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff597b661 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff597b661 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007ffff597c95d in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff597cabf in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff72b41d3 in gtk_widget_get_scale_factor (widget=<optimized out>)
at /build/gtk+3.0-3.22.17/./gtk/gtkwidget.c:10882
#4 0x00007ffff70dcbb9 in gtk_css_widget_node_get_style_provider (node=0x555555f036a0)
at /build/gtk+3.0-3.22.17/./gtk/gtkcsswidgetnode.c:246
#5 0x00007ffff70c323c in gtk_css_node_get_style_provider_or_null (cssnode=0x555555f036a0)
at /build/gtk+3.0-3.22.17/./gtk/gtkcssnode.c:121
#6 0x00007ffff70c323c in gtk_css_node_invalidate_style_provider (cssnode=<optimized out>)
at /build/gtk+3.0-3.22.17/./gtk/gtkcssnode.c:1316
#7 0x00007ffff5c50065 in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8 0x00007ffff5c627b2 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007ffff5c6b40c in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007ffff5c6b7ef in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007ffff721a93f in _gtk_style_provider_private_changed (provider=<optimized out>)
at /build/gtk+3.0-3.22.17/./gtk/gtkstyleproviderprivate.c:113
#12 0x00007ffff7214755 in _gtk_style_cascade_add_provider (cascade=0x555555813d30, provider=0x555555f92620, priority=800)
at /build/gtk+3.0-3.22.17/./gtk/gtkstylecascade.c:380
#13 0x0000555555567f4a in gl_window_init (window=<optimized out>) at src/gl-window.c:449
#14 0x00007ffff5c73b9b in g_type_create_instance () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff5c554fb in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
find here.
#13 0x0000555555567f4a in gl_window_init (window=<optimized out>) at src/gl-window.c:449
okay , get it!
Don’t load global styles inside the instance init; load it inside a single place, like GApplication::startup
and reloading the same style, and adding a new style provider, every time instantiate the window
So, quick thing: the instance initialization is just that: it should initialise your instance to a known, inert state; if you want to do things more complicated than that, you should split off your work in various places
For instance: loading resources tied to the windowing system goes into realize () (and unrealize () for the unloading ),For global things, like custom theme, use GApplication’s startup.
If you need to set up state after construction, but before g_object_new() returns, use GObjectClass.constructed ().
Inside instance_init you have a zero’ed out instance structure, and not much more; GTK+ sets up its own state in various steps, and not all of them by the time your code is called
here is my diff for that
https://gitlab.gnome.org/GNOME/gnome-logs/merge_requests/6
#22 No display results will crash.
bug trackeer
Thread 1 "gnome-logs" received signal SIGSEGV, Segmentation fault.
0x000055555556626e in gl_journal_model_process_query (model=0x555555b068c0) at src/gl-journal-model.c:649
649 search_match = g_ptr_array_index (category_matches, category_matches->len - 1);
(gdb) bt
#0 0x000055555556626e in gl_journal_model_process_query (model=0x555555b068c0) at src/gl-journal-model.c:649
#1 0x000055555556626e in gl_journal_model_take_query (model=0x555555b068c0, query=<optimized out>)
at src/gl-journal-model.c:729
#2 0x00007ffff5c50065 in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3 0x00007ffff5c627b2 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4 0x00007ffff5c6b40c in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff5c6b7ef in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff5c546a4 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
that seemed something wrong here
at src/gl-journal-model.c:649
649 search_match = g_ptr_array_index (category_matches, category_matches->len - 1);
after checking, I find sometimes category_matches->len will be 0.
So should check against 0 in advanced!
here is my patch for that ,
https://gitlab.gnome.org/GNOME/gnome-logs/merge_requests/8
#24 gnome-logs-3.24.2: QA Notice: Package triggers severe warnings which indicate that it may exhibit random runtime failures.
as for this issue .
ah, It’s seem odd, In gnome-logs-3.24.2, I couldn’t reproduce this issue.
src/gl-journal-model.c:880: for (j = i; j < match_count - 2; j++)
has already checked for (src/gl-journal-model.c:893:32 , src/gl-journal-model.c:892:49).
src/gl-journal-model.c:909: for (j = i; j < match_count - 2; j++)
also has already checked for (src/gl-journal-model.c:911:49 , src/gl-journal-model.c:912:32).
and my mentor David could not reprduce it either.
Okay, That’s all, I complish most of my work on gnome-logs.