da-liii/texmacs-1

Segmentation Fault when changing language in Preferences

Opened this issue · 4 comments

TeXmacs] With linked TrueType support
Throwing segmentation fault
-------------------------------------------------
Error message:
  segmentation fault

System information:
  TeXmacs version  : 1.99.5
  Built by         : rendong
  Building date    : 2017-09-27T10:46:31
  Operating system : linux-gnu
  Vendor           : pc
  Processor        : x86_64
  Crash date       : 2017年10月 2日 星期一 21时50分20秒 CST

Editor status:
  Root path          : [ 1 ]
  Current path       : [ 1, 0, 0 ]
  Shifted path       : [ 1, 0, 0 ]
  Physical selection : [ 1, 0, 0 ] -- [ 1, 0, 0 ]

Backtrace of C++ stack:
  1   texmacs.bin                         0x000000010fc7ee3f : get_crash_report(char const*) + 415
  2   texmacs.bin                         0x000000010fafc0da : tm_throw(char const*) + 90
  3   texmacs.bin                         0x000000010fc82aca : clean_exit_on_segfault(int) + 26
  4   libsystem_platform.dylib            0x00007fff964ed52a : _sigtramp() + 26
  5   ???                                 0x0000000000000000 : 0x0() + 0
  6   libqcocoa.dylib                     0x0000000114345108 : qt_plugin_instance() + 170728
  7   libqcocoa.dylib                     0x00000001143439b4 : qt_plugin_instance() + 164756
  8   libqcocoa.dylib                     0x000000011434416b : qt_plugin_instance() + 166731
  9   QtWidgets                           0x0000000110f081cb : QMenuBar::actionEvent(QActionEvent*) + 1003
  10  QtWidgets                           0x0000000110dcb2e3 : QWidget::event(QEvent*) + 275
  11  QtWidgets                           0x0000000110f087c2 : QMenuBar::event(QEvent*) + 482
  12  QtWidgets                           0x0000000110d90ded : QApplicationPrivate::notify_helper(QObject*, QEvent*) + 301
  13  QtWidgets                           0x0000000110d92167 : QApplication::notify(QObject*, QEvent*) + 391
  14  texmacs.bin                         0x0000000110215351 : QTMApplication::notify(QObject*, QEvent*) + 33
  15  QtCore                              0x0000000111a29ea4 : QCoreApplication::notifyInternal2(QObject*, QEvent*) + 164
  16  QtWidgets                           0x0000000110dbf58f : QWidget::insertAction(QAction*, QAction*) + 367
  17  texmacs.bin                         0x00000001101b6fca : qt_tm_widget_rep::install_main_menu() + 554
  18  texmacs.bin                         0x00000001101b761c : qt_tm_widget_rep::write(slot, blackbox, widget) + 1164
  19  texmacs.bin                         0x000000010fc6db65 : write(widget, slot, widget) + 101
  20  texmacs.bin                         0x000000010fc9c199 : set_main_menu(widget, widget) + 89
  21  texmacs.bin                         0x000000010fc9c0a1 : tm_window_rep::menu_main(string) + 193
  22  texmacs.bin                         0x000000010fc953cc : tm_frame_rep::menu_main(string) + 76
  23  texmacs.bin                         0x000000010fc95425 : virtual thunk to tm_frame_rep::menu_main(string) + 37
  24  texmacs.bin                         0x000000010f8d0260 : edit_interface_rep::update_menus() + 176
  25  texmacs.bin                         0x000000010f8d11b2 : edit_interface_rep::apply_changes() + 178
  26  texmacs.bin                         0x000000010f8d79b5 : virtual thunk to edit_interface_rep::apply_changes() + 37
  27  texmacs.bin                         0x000000010fc816a9 : tm_server_rep::interpose_handler() + 281
  28  texmacs.bin                         0x000000010fc81875 : virtual thunk to tm_server_rep::interpose_handler() + 37
  29  texmacs.bin                         0x000000010fc7fd86 : texmacs_interpose_handler() + 54
  30  texmacs.bin                         0x0000000110195d13 : qt_gui_rep::update() + 611
  31  texmacs.bin                         0x00000001101e8555 : QTMGuiHelper::doUpdate() + 21
  32  texmacs.bin                         0x0000000110215d17 : QTMGuiHelper::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 199
  33  QtCore                              0x0000000111a5bd49 : QMetaObject::activate(QObject*, int, int, void**) + 3113
  34  QtCore                              0x0000000111a638c4 : QTimer::timerEvent(QTimerEvent*) + 100
  35  QtCore                              0x0000000111a53a7d : QObject::event(QEvent*) + 77
  36  QtWidgets                           0x0000000110d90ded : QApplicationPrivate::notify_helper(QObject*, QEvent*) + 301
  37  QtWidgets                           0x0000000110d92167 : QApplication::notify(QObject*, QEvent*) + 391
  38  texmacs.bin                         0x0000000110215351 : QTMApplication::notify(QObject*, QEvent*) + 33
  39  QtCore                              0x0000000111a29ea4 : QCoreApplication::notifyInternal2(QObject*, QEvent*) + 164
  40  QtCore                              0x0000000111a81f01 : QTimerInfoList::activateTimers() + 897
  41  libqcocoa.dylib                     0x0000000114339f42 : qt_plugin_instance() + 125218
  42  CoreFoundation                      0x00007fff9787a7e1 : __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__() + 17
  43  CoreFoundation                      0x00007fff97859f0c : __CFRunLoopDoSources0() + 556
  44  CoreFoundation                      0x00007fff9785942f : __CFRunLoopRun() + 927
  45  CoreFoundation                      0x00007fff97858e28 : CFRunLoopRunSpecific() + 296
  46  HIToolbox                           0x00007fff8a8bb935 : RunCurrentEventLoopInMode() + 235
  47  HIToolbox                           0x00007fff8a8bb76f : ReceiveNextEventCommon() + 432
  48  HIToolbox                           0x00007fff8a8bb5af : _BlockUntilNextEventMatchingListInModeWithFilter() + 71
  49  AppKit                              0x00007fff8c9d6df6 : _DPSNextEvent() + 1067
  50  AppKit                              0x00007fff8c9d6226 -[NSApplication : _nextEventMatchingEventMask:untilDate:inMode:dequeue:]() + 454
  51  AppKit                              0x00007fff8c9cad80 -[NSApplication : run]() + 682
  52  libqcocoa.dylib                     0x000000011433ac23 : qt_plugin_instance() + 128515
  53  QtCore                              0x0000000111a25a31 : QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 417
  54  QtCore                              0x0000000111a2a548 : QCoreApplication::exec() + 392
  55  texmacs.bin                         0x0000000110195a9b : qt_gui_rep::event_loop() + 43
  56  texmacs.bin                         0x0000000110195f50 : gui_start_loop() + 16
  57  texmacs.bin                         0x000000010fc8719d : TeXmacs_main(int, char**) + 18013
  58  texmacs.bin                         0x000000010fb28163 : new_call_back(void*, int, char**) + 35
  59  libguile.17.dylib                   0x0000000110b52197 : invoke_main_func() + 36
  60  libguile.17.dylib                   0x0000000110b2b223 : c_body() + 15
  61  libguile.17.dylib                   0x0000000110b87b6f : scm_c_catch() + 502
  62  libguile.17.dylib                   0x0000000110b2b1b2 : scm_i_with_continuation_barrier() + 157
  63  libguile.17.dylib                   0x0000000110b2b20a : scm_c_with_continuation_barrier() + 52
  64  libguile.17.dylib                   0x0000000110b85bc7 : scm_i_with_guile_and_parent() + 41
  65  libguile.17.dylib                   0x0000000110b5215d : scm_boot_guile() + 39
  66  texmacs.bin                         0x000000010fb2813a : start_scheme(int, char**, void (*)(int, char**)) + 74
  67  texmacs.bin                         0x000000010fc88d9f : main() + 1359
  68  libdyld.dylib                       0x00007fff97cbe5ad : start() + 1

-------------------------------------------------
libc++abi.dylib: terminating with uncaught exception of type string
[1]    85174 abort      texmacs xx.tm

Debug use lldb:

* thread #1: tid = 0x9c42f, 0x000000010714101d libqcocoa.dylib`___lldb_unnamed_symbol662$$libqcocoa.dylib + 29, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
    frame #0: 0x000000010714101d libqcocoa.dylib`___lldb_unnamed_symbol662$$libqcocoa.dylib + 29
libqcocoa.dylib`___lldb_unnamed_symbol662$$libqcocoa.dylib:
->  0x10714101d <+29>: movq   0x20(%r14), %rax
    0x107141021 <+33>: movq   %rax, -0x38(%rbp)
    0x107141025 <+37>: movl   (%rax), %ecx
    0x107141027 <+39>: cmpl   $-0x1, %ecx
(lldb) n
Process 94462 stopped
* thread #1: tid = 0xa6597, 0x0000000100c5bf4d texmacs.bin`qt_tm_widget_rep::install_main_menu(this=0x0000000102bc1738) + 429 at qt_tm_widget.cpp:746, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100c5bf4d texmacs.bin`qt_tm_widget_rep::install_main_menu(this=0x0000000102bc1738) + 429 at qt_tm_widget.cpp:746
   743 	      //TRICK: Mac native QMenuBar accepts only menus which are already populated
   744 	      // this will cause a problem for us, since menus are lazy and populated only after triggering
   745 	      // this is the reason we add a dummy action before inserting the menu
-> 746 	      a->menu()->addAction("native menubar trick");
   747 	      dest->addAction(a->menu()->menuAction());
   748 	      QObject::connect (a->menu(),         SIGNAL (aboutToShow()),
   749 	                        the_gui->gui_helper, SLOT (aboutToShowMainMenu()));
(lldb) n
Process 94462 stopped
* thread #1: tid = 0xa6597, 0x0000000100c5bf9c texmacs.bin`qt_tm_widget_rep::install_main_menu(this=0x0000000102bc1738) + 508 at qt_tm_widget.cpp:747, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100c5bf9c texmacs.bin`qt_tm_widget_rep::install_main_menu(this=0x0000000102bc1738) + 508 at qt_tm_widget.cpp:747
   744 	      // this will cause a problem for us, since menus are lazy and populated only after triggering
   745 	      // this is the reason we add a dummy action before inserting the menu
   746 	      a->menu()->addAction("native menubar trick");
-> 747 	      dest->addAction(a->menu()->menuAction());
   748 	      QObject::connect (a->menu(),         SIGNAL (aboutToShow()),
   749 	                        the_gui->gui_helper, SLOT (aboutToShowMainMenu()));
   750 	      QObject::connect (a->menu(),         SIGNAL (aboutToHide()),
(lldb) n
Process 94462 stopped
* thread #1: tid = 0xa6597, 0x000000010714101d libqcocoa.dylib`___lldb_unnamed_symbol662$$libqcocoa.dylib + 29, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
    frame #0: 0x000000010714101d libqcocoa.dylib`___lldb_unnamed_symbol662$$libqcocoa.dylib + 29
libqcocoa.dylib`___lldb_unnamed_symbol662$$libqcocoa.dylib:
->  0x10714101d <+29>: movq   0x20(%r14), %rax
    0x107141021 <+33>: movq   %rax, -0x38(%rbp)
    0x107141025 <+37>: movl   (%rax), %ecx
    0x107141027 <+39>: cmpl   $-0x1, %ecx

the related commit: da-liii/texmacs@9d0f051

@mgubi

  • change language -> change all the menu -> segmentfault
  • Tools Links Developer Tool -> only add a new menu -> won't crash

The two actions both run the code in install_main_menu