Il 29/01/2011 19:12, Enrico Forestieri ha scritto:
just don't even try it: my own brand new automated tests just started
to fail because, with that template-ish thing, at the first attempt of
typing a character in text-mode LyX was asserting :-).
I'm using the Enrico's patch that works fine (at least on my 64-bit
machine).
Yet, I think your idea is right for avoiding code duplication. Let's see
whether requiring explicit instantiations works. If yes, adding a
forgotten type would only require adding a single-line instantiation
declaration.
So, does the attach patch work for you?
If it is the same currently committed, then it is sufficient to:
-) create a new file
-) type any letter and kaboom!
(gdb) run
Starting program: /home/tommaso/lyx-trunk-ws/lyx-devel/src/lyx
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff04a3700 (LWP 7933)]
GuiToolbar.cpp(335): Session settings could not be found!. Defaults are
used instead
/usr/include/c++/4.4/bits/basic_string.h:745: typename
_Alloc::rebind<_CharT>::other::reference std::basic_string<Char, Traits,
Alloc>::operator[](typename _Alloc::rebind<_CharT>::other::size_type)
[with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>, _Alloc =
std::allocator<wchar_t>]: Assertion '__pos < size()' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff5f51ba5 in raise () from /lib/libc.so.6
(gdb) bt
#0 0x00007ffff5f51ba5 in raise () from /lib/libc.so.6
#1 0x00007ffff5f556b0 in abort () from /lib/libc.so.6
#2 0x000000000062c62a in __replacement_assert (this=0x1b6bb68, __pos=1)
at /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h:284
#3 std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::operator[] (this=0x1b6bb68, __pos=1) at
/usr/include/c++/4.4/bits/basic_string.h:745
#4 0x00000000006165de in lyx::Paragraph::isWordSeparator
(this=0x1b6b000, pos=1) at Paragraph.cpp:2850
#5 0x0000000000619035 in lyx::Paragraph::isMisspelled (this=0x1b6b000,
pos=1, check_boundary=true) at Paragraph.cpp:3769
#6 0x00000000006786f9 in lyx::Text::dispatch (this=<value optimized
out>, cur=..., cmd=<value optimized out>) at Text3.cpp:2195
#7 0x0000000000985217 in lyx::InsetText::doDispatch (this=0x1b6b5a0,
cur=..., cmd=...) at insets/InsetText.cpp:290
#8 0x0000000000870cf1 in lyx::Inset::dispatch (this=0x1b6b5a0, cur=...,
cmd=...) at insets/Inset.cpp:315
#9 0x000000000071af19 in lyx::Cursor::dispatch (this=0x1b78b78,
cmd0=...) at Cursor.cpp:370
#10 0x00000000009f1b84 in lyx::frontend::GuiView::dispatchToBufferView
(this=0x180c940, cmd=..., dr=...) at GuiView.cpp:3029
#11 0x0000000000a0c816 in lyx::frontend::GuiView::dispatch
(this=0x180c940, cmd=..., dr=...) at GuiView.cpp:3508
#12 0x00000000009cd979 in lyx::frontend::GuiApplication::dispatch
(this=0x12a1f10, cmd=..., dr=...) at GuiApplication.cpp:1679
#13 0x00000000009c835c in lyx::frontend::GuiApplication::dispatch
(this=0x12a1f10, cmd=...) at GuiApplication.cpp:1139
#14 0x00000000005b89dd in lyx::dispatch (action=...) at LyX.cpp:1280
#15 0x00000000009c0802 in
lyx::frontend::GuiApplication::processFuncRequest (this=<value optimized
out>, func=...) at GuiApplication.cpp:1815
#16 0x00000000009c74f2 in lyx::frontend::GuiApplication::processKeySym
(this=0x12a1f10, keysym=..., state=lyx::NoModifier) at
GuiApplication.cpp:1805
#17 0x0000000000a1be7f in lyx::frontend::GuiWorkArea::processKeySym
(this=0x1b6e990, key=..., mod=lyx::NoModifier) at GuiWorkArea.cpp:489
#18 0x0000000000a1f490 in lyx::frontend::GuiWorkArea::keyPressEvent
(this=0x1b6e990, ev=0x7fffffff9730) at GuiWorkArea.cpp:1011
#19 0x00007ffff70e9cfa in QWidget::event (this=0x1b6e990,
event=0x7fffffff9730) at kernel/qwidget.cpp:8222
#20 0x00007ffff74b55e6 in QFrame::event (this=0x1b6e990,
e=0x7fffffff9730) at widgets/qframe.cpp:557
#21 0x00007ffff754371b in QAbstractScrollArea::event (this=0x1b6e990,
e=0x7fffffff9730) at widgets/qabstractscrollarea.cpp:996
#22 0x0000000000a1c3fe in lyx::frontend::GuiWorkArea::event
(this=0x1b6e990, e=0x1efa) at GuiWorkArea.cpp:692
#23 0x00007ffff7093fdc in QApplicationPrivate::notify_helper
(this=0x12a9790, receiver=0x1b6e990, e=0x7fffffff9730) at
kernel/qapplication.cpp:4396
#24 0x00007ffff709b346 in QApplication::notify (this=<value optimized
out>, receiver=0x1b6e990, e=0x7fffffff9730) at kernel/qapplication.cpp:3857
#25 0x00000000009c27ad in lyx::frontend::GuiApplication::notify
(this=0x1efa, receiver=0x1efa, event=0x6) at GuiApplication.cpp:2193
#26 0x00007ffff6ba8cdc in QCoreApplication::notifyInternal
(this=0x12a1f10, receiver=0x1b6e990, event=0x7fffffff9730) at
kernel/qcoreapplication.cpp:732
#27 0x00007ffff71414ba in QKeyMapper::sendKeyEvent (keyWidget=0x1b6e990,
grab=<value optimized out>, type=QEvent::KeyPress, code=65,
modifiers=<value optimized out>,
text=..., autorepeat=false, count=1, nativeScanCode=38,
nativeVirtualKey=97, nativeModifiers=16) at kernel/qkeymapper_x11.cpp:1867
#28 0x00007ffff7143ac0 in QKeyMapperPrivate::translateKeyEvent
(this=0x12f5bf0, keyWidget=0x1b6e990, event=<value optimized out>,
grab=250) at kernel/qkeymapper_x11.cpp:1837
#29 0x00007ffff711acb4 in QApplication::x11ProcessEvent (this=<value
optimized out>, event=0x7fffffffa300) at kernel/qapplication_x11.cpp:3429
#30 0x00007ffff71470e2 in x11EventSourceDispatch (s=0x12aa530,
callback=<value optimized out>, user_data=<value optimized out>) at
kernel/qguieventdispatcher_glib.cpp:146
#31 0x00007ffff5396342 in g_main_context_dispatch () from
/lib/libglib-2.0.so.0
#32 0x00007ffff539a2a8 in ?? () from /lib/libglib-2.0.so.0
#33 0x00007ffff539a45c in g_main_context_iteration () from
/lib/libglib-2.0.so.0
#34 0x00007ffff6bd5193 in QEventDispatcherGlib::processEvents
(this=0x125a180, flags=<value optimized out>) at
kernel/qeventdispatcher_glib.cpp:415
#35 0x00007ffff7146a4e in QGuiEventDispatcherGlib::processEvents
(this=0x1efa, flags=<value optimized out>) at
kernel/qguieventdispatcher_glib.cpp:204
#36 0x00007ffff6ba7a02 in QEventLoop::processEvents (this=<value
optimized out>, flags=DWARF-2 expression error: DW_OP_reg operations
must be used either alone or in conjuction with DW_OP_piece or
DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#37 0x00007ffff6ba7dec in QEventLoop::exec (this=0x7fffffffa630,
flags=DWARF-2 expression error: DW_OP_reg operations must be used either
alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:201
#38 0x00007ffff6babebb in QCoreApplication::exec () at
kernel/qcoreapplication.cpp:1009
#39 0x00000000009c05cf in lyx::frontend::GuiApplication::exec
(this=0x12a1f10) at GuiApplication.cpp:1979
#40 0x00000000005c2c85 in lyx::LyX::exec (this=<value optimized out>,
argc=<value optimized out>, argv=<value optimized out>) at LyX.cpp:398
#41 0x00000000004374f5 in main (argc=1, argv=0x7fffffffe068) at main.cpp:42
(gdb)
T.