phase1geo / Journaler

Journaling application for elementary OS
GNU General Public License v3.0
4 stars 1 forks source link

Crash on right-click menu opening #5

Closed prokoudine closed 9 months ago

prokoudine commented 9 months ago
  1. Create a new entry
  2. Type something in a language that is not English (words get underlined)
  3. Select text
  4. Right-click to open menu (to see if it's possible to choose a different language for spellchecking)
  5. BOOM
(com.github.phase1geo.journaler:338256): GLib-GIO-ERROR **: 14:22:40.634: g_menu_item_set_detailed_action: Detailed action name '' has invalid format

Thread 1 "com.github.phas" received signal SIGTRAP, Trace/breakpoint trap.
g_log_structured_array (log_level=log_level@entry=G_LOG_LEVEL_ERROR, fields=fields@entry=0x7fffffffc240, n_fields=4)
    at ../../../glib/gmessages.c:556
Downloading source file /usr/src/glib2.0-2.78.0-2/debian/build/deb/../../../glib/gmessages.c
556         G_BREAKPOINT ();                                                                                                                
(gdb) bt
#0  g_log_structured_array (log_level=log_level@entry=G_LOG_LEVEL_ERROR, fields=fields@entry=0x7fffffffc240, n_fields=4)
    at ../../../glib/gmessages.c:556
#1  0x00007ffff7e47b52 in g_log_default_handler
    (log_domain=log_domain@entry=0x7ffff7171015 "GLib-GIO", log_level=log_level@entry=6, message=message@entry=0x555558f3ec10 "g_menu_item_set_detailed_action: Detailed action name '' has invalid format", unused_data=unused_data@entry=0x0) at ../../../glib/gmessages.c:3284
#2  0x00007ffff7e489e2 in g_logv
    (log_domain=0x7ffff7171015 "GLib-GIO", log_level=G_LOG_LEVEL_ERROR, format=<optimized out>, args=args@entry=0x7fffffffc390)
    at ../../../glib/gmessages.c:1392
#3  0x00007ffff7e48ca3 in g_log
    (log_domain=log_domain@entry=0x7ffff7171015 "GLib-GIO", log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x7ffff718ab58 "g_menu_item_set_detailed_action: %s") at ../../../glib/gmessages.c:1461
#4  0x00007ffff7112fc1 in g_menu_item_set_detailed_action
    (menu_item=menu_item@entry=0x555558f4a350, detailed_action=detailed_action@entry=0x555555638f5f "") at ../../../gio/gmenu.c:1107
#5  0x00007ffff7113052 in g_menu_item_new (label=0x555555638f2d "No suggestions", detailed_action=0x555555638f5f "")
    at ../../../gio/gmenu.c:1145
#6  0x00007ffff7113079 in g_menu_insert (menu=0x555558cdfa40, position=-1, label=<optimized out>, detailed_action=<optimized out>)
    at ../../../gio/gmenu.c:275
#7  0x00005555555ee64d in spell_checker_add_suggestion_menus (self=0x555555e73630, word=0x555558cd74c0 "непонятно")
    at ../src/SpellChecker.vala:234
#8  0x00005555555ef045 in spell_checker_populate_popup (self=0x555555e73630) at ../src/SpellChecker.vala:276
#9  0x00005555555ef386 in spell_checker_right_button_press_event
    (self=0x555555e73630, n_press=1, x=468.04849243164062, y=20.81077766418457) at ../src/SpellChecker.vala:289
#10 0x00005555555f07ea in _spell_checker_right_button_press_event_gtk_gesture_click_pressed
    (_sender=0x555555da4250, n_press=1, x=468.04849243164062, y=20.81077766418457, self=0x555555e73630) at ../src/SpellChecker.vala:355
#15 0x00007ffff7f60c93 in <emit signal 'pressed' on instance ???>
    (instance=instance@entry=0x555555da4250, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3675
    #11 0x00007ffff72b2295 in _gtk_marshal_VOID__INT_DOUBLE_DOUBLEv
    (closure=<optimized out>, return_value=<optimized out>, instance=<optimized out>, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x555555944640) at gtk/gtkmarshalers.c:3688
    #12 0x00007ffff7f60add in _g_closure_invoke_va
    (param_types=0x555555944640, n_params=<optimized out>, args=0x7fffffffcd00, instance=0x555555da4250, return_value=0x0, closure=0x55555654b7a0) at ../../../gobject/gclosure.c:895
    #13 signal_emit_valist_unlocked
    (instance=instance@entry=0x555555da4250, signal_id=signal_id@entry=112, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffcd00)
--Type <RET> for more, q to quit, c to continue without paging--c
    at ../../../gobject/gsignal.c:3516
    #14 0x00007ffff7f60bd6 in g_signal_emit_valist
    (instance=0x555555da4250, signal_id=112, detail=0, var_args=var_args@entry=0x7fffffffcd00) at ../../../gobject/gsignal.c:3355
#16 0x00007ffff735154b in gtk_gesture_click_begin (gesture=0x555555da4250, sequence=sequence@entry=0x0)
    at ../../../gtk/gtkgestureclick.c:230
#21 0x00007ffff7f60c93 in <emit signal 'begin' on instance ???>
    (instance=instance@entry=0x555555da4250, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3675
    #17 0x00007ffff7f45df6 in g_cclosure_marshal_VOID__BOXEDv
    (closure=0x55555594be70, return_value=<optimized out>, instance=0x555555da4250, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x5555558e3070) at ../../../gobject/gmarshal.c:1686
    #18 0x00007ffff7f60add in _g_closure_invoke_va
    (param_types=0x5555558e3070, n_params=<optimized out>, args=0x7fffffffd0c0, instance=0x555555da4250, return_value=0x0, closure=0x55555594be70) at ../../../gobject/gclosure.c:895
    #19 signal_emit_valist_unlocked
    (instance=instance@entry=0x555555da4250, signal_id=signal_id@entry=107, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffd0c0)
    at ../../../gobject/gsignal.c:3516
    #20 0x00007ffff7f60bd6 in g_signal_emit_valist
    (instance=0x555555da4250, signal_id=107, detail=0, var_args=var_args@entry=0x7fffffffd0c0) at ../../../gobject/gsignal.c:3355
#22 0x00007ffff734bb16 in _gtk_gesture_set_recognized (recognized=<optimized out>, sequence=0x0, gesture=0x555555da4250)
    at ../../../gtk/gtkgesture.c:338
#23 _gtk_gesture_set_recognized (sequence=0x0, recognized=1, gesture=0x555555da4250) at ../../../gtk/gtkgesture.c:324
#24 _gtk_gesture_check_recognized (gesture=gesture@entry=0x555555da4250, sequence=sequence@entry=0x0) at ../../../gtk/gtkgesture.c:384
#25 0x00007ffff734c6d5 in gtk_gesture_handle_event
    (controller=0x555555da4250, event=<optimized out>, x=468.04849243164062, y=20.81077766418457) at ../../../gtk/gtkgesture.c:655
#26 0x00007ffff73520e8 in gtk_gesture_single_handle_event
    (controller=0x555555da4250, event=0x555558bd8ce0, x=468.04849243164062, y=20.81077766418457) at ../../../gtk/gtkgesturesingle.c:227
#27 0x00007ffff7462fc8 in gtk_event_controller_handle_event
    (y=<optimized out>, x=<optimized out>, target=<optimized out>, event=<optimized out>, controller=<optimized out>)
    at ../../../gtk/gtkeventcontroller.c:362
#28 gtk_widget_run_controllers
    (widget=widget@entry=0x555555dbad20, event=event@entry=0x555558bd8ce0, target=target@entry=0x555555dbad20, x=468.04849243164062, y=20.81077766418457, phase=phase@entry=GTK_PHASE_BUBBLE) at ../../../gtk/gtkwidget.c:4581
#29 0x00007ffff74632f9 in gtk_widget_event (target=0x555555dbad20, event=0x555558bd8ce0, widget=0x555555dbad20)
    at ../../../gtk/gtkwidget.c:4775
#30 gtk_widget_event (widget=0x555555dbad20, event=0x555558bd8ce0, target=0x555555dbad20) at ../../../gtk/gtkwidget.c:4751
#31 0x00007ffff76a417e in gtk_propagate_event_internal.isra.0 (widget=0x555555dbad20, event=0x555558bd8ce0, topmost=<optimized out>)
    at ../../../gtk/gtkmain.c:1942
#32 0x00007ffff738e5cd in gtk_main_do_event (event=0x555558bd8ce0) at ../../../gtk/gtkmain.c:1684
#33 0x00007ffff747b31c in surface_event.lto_priv () at ../../../gtk/gtkwindow.c:4826
#34 0x00007ffff72b6c2c in _gtk_marshal_BOOLEAN__STRING
    (closure=0x555558af9a50, return_value=0x7fffffffd6b0, param_values=0x7fffffffd740, marshal_data=<optimized out>, invocation_hint=<optimized out>, n_param_values=<optimized out>) at gtk/gtkmarshalers.c:1607
#35 0x00007ffff763d6e1 in _gdk_marshal_BOOLEAN__POINTER
    (marshal_data=0x0, invocation_hint=<optimized out>, param_values=0x7fffffffd740, n_param_values=2, return_value=0x7fffffffd6b0, closure=0x555558af9a50) at gdk/gdkmarshalers.c:244
#36 gdk_surface_event_marshaller
    (closure=0x555558af9a50, return_value=0x7fffffffd6b0, n_param_values=2, param_values=0x7fffffffd740, invocation_hint=<optimized out>, marshal_data=0x0) at ../../../gdk/gdksurface.c:433
#37 0x00007ffff7f42130 in g_closure_invoke
    (closure=0x555558af9a50, return_value=0x7fffffffd6b0, n_param_values=2, param_values=0x7fffffffd740, invocation_hint=0x7fffffffd690)
    at ../../../gobject/gclosure.c:832
#38 0x00007ffff7f6f4ac in signal_emit_unlocked_R.isra.0
    (node=node@entry=0x7fffffffd830, detail=detail@entry=0, instance=instance@entry=0x55555692b9e0, emission_return=emission_return@entry=0x7fffffffd8b0, instance_and_params=instance_and_params@entry=0x7fffffffd740) at ../../../gobject/gsignal.c:3980
#39 0x00007ffff7f60312 in signal_emit_valist_unlocked
    (instance=instance@entry=0x55555692b9e0, signal_id=signal_id@entry=41, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffd990)
    at ../../../gobject/gsignal.c:3625
#40 0x00007ffff7f60bd6 in g_signal_emit_valist (instance=0x55555692b9e0, signal_id=41, detail=0, var_args=var_args@entry=0x7fffffffd990)
    at ../../../gobject/gsignal.c:3355
#41 0x00007ffff7f60c93 in g_signal_emit (instance=instance@entry=0x55555692b9e0, signal_id=<optimized out>, detail=detail@entry=0)
    at ../../../gobject/gsignal.c:3675
#42 0x00007ffff76987f6 in gdk_surface_handle_event.isra.0 (event=0x555558bd8ce0) at ../../../gdk/gdksurface.c:2939
#43 0x00007ffff760fe7e in gdk_event_source_dispatch.lto_priv () at ../../../gdk/x11/gdkeventsource.c:418
#44 0x00007ffff7e40b2c in g_main_dispatch (context=0x55555569fae0) at ../../../glib/gmain.c:3476
#45 0x00007ffff7e9c46f in g_main_context_dispatch_unlocked (context=0x55555569fae0) at ../../../glib/gmain.c:4284
#46 g_main_context_iterate_unlocked.isra.0
    (context=context@entry=0x55555569fae0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at ../../../glib/gmain.c:4349
#47 0x00007ffff7e3ed20 in g_main_context_iteration (context=context@entry=0x55555569fae0, may_block=may_block@entry=1)
    at ../../../glib/gmain.c:4414
#48 0x00007ffff710db5d in g_application_run (application=0x55555569b540, argc=<optimized out>, argv=0x7fffffffddc8)
    at ../../../gio/gapplication.c:2577
#49 0x0000555555578967 in journaler_main (args=0x7fffffffddc8, args_length1=1) at ../src/Application.vala:144
#50 0x00005555555789ae in main (argc=1, argv=0x7fffffffddc8) at ../src/Application.vala:139
(gdb) 
phase1geo commented 9 months ago

The application crash appears to be an issue in my code when there are no suggestions. I'll get that fixed.

As for switching languages used by the spell checker, I don't have a way (currently) to do that :) I'll get that added as well. I will probably add that in the preferences panel, unless you think there is value in changing it through the contextual dropdown menu. Thoughts?

prokoudine commented 9 months ago

Preferences should be fine. I don't expect people swap languages all the time, although, what do I really know? :)

phase1geo commented 9 months ago

I looked a bit closer at the code, the language used by the spellchecker is initially selected based on the value of the user's LANGUAGE environment variable when the application starts up. So at least it doesn't always default to something like English. At any rate, I'll get the application crash issue fixed and add a preferences selection.

phase1geo commented 9 months ago

I have this issue fixed in the main branch. I decided to not add the spell checker to preferences. Instead, I enhanced/fixed an issue with selecting the spell checker from the environment, so this should be more robust going forward.

prokoudine commented 9 months ago

The thing is, I mostly use UIs in English these days, but I still write stuff in my native language. So for me personally, defaulting to system's env settings is fine as long as it's possible to override.

phase1geo commented 9 months ago

Excellent point. I will add the preference setting.

phase1geo commented 9 months ago

I have committed a change to the main branch which adds the new preferences option. It will default to the system setting, but can be changed to any language that is supported by the enchant library on your system. If you are missing your language, add the "hunspell-ru" package (it may already be install on your system).