Maurizio Monge <[EMAIL PROTECTED]> writes:

| #0  0x0000002a980626e9 in kill () from /lib64/libc.so.6
| #1  0x0000002a9736b111 in pthread_kill () from /lib64/libpthread.so.0
| #2  0x0000002a9736b432 in raise () from /lib64/libpthread.so.0
| #3  0x0000002a980623d2 in raise () from /lib64/libc.so.6
| #4  0x0000002a98063944 in abort () from /lib64/libc.so.6
| #5  0x0000002a975a6048 in __gnu_cxx::__verbose_terminate_handler ()
|     at ../../../../libstdc++-v3/libsupc++/vterminate.cc:96
| #6  0x0000002a975a4236 in __cxxabiv1::__terminate (handler=0x7261)
|     at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:43
| #7  0x0000002a975a4263 in std::terminate ()
|     at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:53
| #8  0x0000002a975a4363 in __cxa_throw (obj=0x7261, tinfo=0x6, dest=0x1)
|     at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:80
| #9  0x0000002a9754a158 in std::__throw_logic_error (
|     __s=0x7261 <Address 0x7261 out of bounds>) at new_allocator.h:69
| #10 0x0000002a975885e6 in std::string::_S_construct<char const*> (__beg=0x0,
|     __end=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>, 
| [EMAIL PROTECTED])
|     at basic_string.tcc:142
| #11 0x0000002a97588693 in basic_string (this=0x7fbffff2b0, __s=0x0, 
| [EMAIL PROTECTED])
|     at basic_string.h:1370

std::string constructor called with NULL, and the exception get
thrown.

| #12 0x0000000000600687 in lyx_gui::sans_font_name () at
| lyx_gui.C:338

because QFontInfo where not able to find a sans-serif font. It seems
to me that the use of QString::latin1 in this funcion (sans_font_name)
is not very safe as it can obviously return NULL.

Can you test this patch and see if the crash goes away?

Index: lyx_gui.C
===================================================================
RCS file:
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lyx_gui.C,v
retrieving revision 1.62
diff -u -p -r1.62 lyx_gui.C
--- lyx_gui.C   3 Apr 2004 08:37:10 -0000       1.62
+++ lyx_gui.C   18 May 2004 06:22:15 -0000
@@ -323,7 +323,9 @@ string const roman_font_name()
        QFont font;
        font.setStyleHint(QFont::Serif);
        font.setFamily("serif");
-       return QFontInfo(font).family().latin1();
+
+       QString name = QFontInfo(font).family().latin1();
+       return name;
 }


@@ -335,7 +337,9 @@ string const sans_font_name()
        QFont font;
        font.setStyleHint(QFont::SansSerif);
        font.setFamily("sans");
-       return QFontInfo(font).family().latin1();
+
+       QString name = QFontInfo(font).family().latin1();
+       return name;
 }


@@ -347,7 +351,9 @@ string const typewriter_font_name()
        QFont font;
        font.setStyleHint(QFont::TypeWriter);
        font.setFamily("monospace");
-       return QFontInfo(font).family().latin1();
+
+       QString name = QFontInfo(font).family().latin1();
+       return name;
 }


-- 
        Lgb

Reply via email to