get QFont from _font

Daniel xracoonx at gmx.de
Wed Aug 12 20:06:48 UTC 2020


On 2020-08-12 17:04, Richard Kimberly Heck wrote:
> On 8/12/20 7:43 AM, Daniel wrote:
>> Does anyone know how to get the QFont from a "Font const & font"? I tried
>>
>> fi = font.fontInfo();
>>
>> with
>>
>> 1. getFont(fi)
>>
>> and also
>>
>> 2. getFont(fi.realize(sane_font))
>>
>> But always get a SIGSEGV within LyX.
> 
> What exactly is the error with the latter?
> 
> Riki

I get the message below. I am still not ably to create a backtrace. But 
the attached patch causes the issue for me when I open the text 
properties dialog. Now, oddly enough only the first time I open it...

(  1) 1   lyx                                 0x0000000108887ae4 
_ZN3lyx8frontend5Alert7doErrorERKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEESA_b 
: 1   lyx                                 0x0000000108887ae4 
_ZN3lyx8frontend5Alert7doErrorERKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEESA_b 
+ 199
(  2) 2   lyx                                 0x0000000108887e59 
_ZN3lyx8frontend5Alert5errorERKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEESA_b 
: 2   lyx                                 0x0000000108887e59 
_ZN3lyx8frontend5Alert5errorERKNSt3__112basic_stringIwNS2_11char_traitsIwEENS2_9allocatorIwEEEESA_b 
+ 135
(  3) 3   lyx                                 0x00000001085e20ac 
_ZN3lyxL13error_handlerEi : 3   lyx 
0x00000001085e20ac _ZN3lyxL13error_handlerEi + 351
(  4) 4   libsystem_platform.dylib            0x00007fff697ef5fd 
_sigtramp : 4   libsystem_platform.dylib            0x00007fff697ef5fd 
_sigtramp + 29
(  5) 5   libsystem_c.dylib                   0x00007fff696aead3 
__v2printf : 5   libsystem_c.dylib                   0x00007fff696aead3 
__v2printf + 475
(  6) 6   lyx                                 0x00000001088bf0ea 
_ZN3lyx8frontend12GuiCharacter14paramsToDialogERKNS_4FontE : 6   lyx 
                              0x00000001088bf0ea 
_ZN3lyx8frontend12GuiCharacter14paramsToDialogERKNS_4FontE + 76
(  7) 7   lyx                                 0x00000001088c0c05 
_ZN3lyx8frontend12GuiCharacter16initialiseParamsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE 
: 7   lyx                                 0x00000001088c0c05 
_ZN3lyx8frontend12GuiCharacter16initialiseParamsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE 
+ 159
(  8) 8   lyx                                 0x00000001088c0c3f 
_ZThn48_N3lyx8frontend12GuiCharacter16initialiseParamsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE 
: 8   lyx                                 0x00000001088c0c3f 
_ZThn48_N3lyx8frontend12GuiCharacter16initialiseParamsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE 
+ 13
(  9) 9   lyx                                 0x000000010886dff7 
_ZN3lyx8frontend6Dialog8showDataERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE 
: 9   lyx                                 0x000000010886dff7 
_ZN3lyx8frontend6Dialog8showDataERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE 
+ 59
( 10) 10  lyx                                 0x0000000108a2250a 
_ZN3lyx8frontend7GuiView12doShowDialogERK7QStringS4_PNS_5InsetE : 10 
lyx                                 0x0000000108a2250a 
_ZN3lyx8frontend7GuiView12doShowDialogERK7QStringS4_PNS_5InsetE + 126
( 11) 11  QtCore                              0x0000000109167a9e 
_ZN11QMetaObject8activateEP7QObjectiiPPv : 11  QtCore 
            0x0000000109167a9e _ZN11QMetaObject8activateEP7QObjectiiPPv 
+ 2238
( 12) 12  lyx                                 0x0000000108a2234b 
_ZN3lyx8frontend7GuiView10showDialogERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_PNS_5InsetE 
: 12  lyx                                 0x0000000108a2234b 
_ZN3lyx8frontend7GuiView10showDialogERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_PNS_5InsetE 
+ 117
( 13) 13  lyx                                 0x0000000108a1a3b4 
_ZN3lyx8frontend7GuiView8dispatchERKNS_11FuncRequestERNS_14DispatchResultE 
: 13  lyx                                 0x0000000108a1a3b4 
_ZN3lyx8frontend7GuiView8dispatchERKNS_11FuncRequestERNS_14DispatchResultE 
+ 6684
( 14) 14  lyx                                 0x000000010888fcba 
_ZN3lyx8frontend14GuiApplication8dispatchERKNS_11FuncRequestERNS_14DispatchResultE 
: 14  lyx                                 0x000000010888fcba 
_ZN3lyx8frontend14GuiApplication8dispatchERKNS_11FuncRequestERNS_14DispatchResultE 
+ 3392
( 15) 15  lyx                                 0x000000010888de2e 
_ZN3lyx8frontend14GuiApplication8dispatchERKNS_11FuncRequestE : 15  lyx 
                                 0x000000010888de2e 
_ZN3lyx8frontend14GuiApplication8dispatchERKNS_11FuncRequestE + 278
( 16) 16  lyx                                 0x000000010886ed69 
_ZN3lyx8frontend6Action6actionEv : 16  lyx 
    0x000000010886ed69 _ZN3lyx8frontend6Action6actionEv + 35
( 17) 17  QtCore                              0x0000000109167a9e 
_ZN11QMetaObject8activateEP7QObjectiiPPv : 17  QtCore 
            0x0000000109167a9e _ZN11QMetaObject8activateEP7QObjectiiPPv 
+ 2238
( 18) 18  QtWidgets                           0x0000000109613615 
_ZN7QAction8activateENS_11ActionEventE : 18  QtWidgets 
          0x0000000109613615 _ZN7QAction8activateENS_11ActionEventE + 309
( 19) 19  QtWidgets                           0x0000000109704623 
_ZN22QAbstractButtonPrivate5clickEv : 19  QtWidgets 
       0x0000000109704623 _ZN22QAbstractButtonPrivate5clickEv + 147
( 20) 20  QtWidgets                           0x00000001097057ac 
_ZN15QAbstractButton17mouseReleaseEventEP11QMouseEvent : 20  QtWidgets 
                          0x00000001097057ac 
_ZN15QAbstractButton17mouseReleaseEventEP11QMouseEvent + 268
( 21) 21  QtWidgets                           0x00000001097fdc3f 
_ZN11QToolButton17mouseReleaseEventEP11QMouseEvent : 21  QtWidgets 
                      0x00000001097fdc3f 
_ZN11QToolButton17mouseReleaseEventEP11QMouseEvent + 15
( 22) 22  QtWidgets                           0x000000010965704a 
_ZN7QWidget5eventEP6QEvent : 22  QtWidgets 
0x000000010965704a _ZN7QWidget5eventEP6QEvent + 442
( 23) 23  QtWidgets                           0x00000001097fe1cf 
_ZN11QToolButton5eventEP6QEvent : 23  QtWidgets 
   0x00000001097fe1cf _ZN11QToolButton5eventEP6QEvent + 319
( 24) 24  QtWidgets                           0x000000010961ca69 
_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent : 24 
QtWidgets                           0x000000010961ca69 
_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 265
( 25) 25  QtWidgets                           0x000000010961f9d8 
_ZN12QApplication6notifyEP7QObjectP6QEvent : 25  QtWidgets 
              0x000000010961f9d8 
_ZN12QApplication6notifyEP7QObjectP6QEvent + 7688
( 26) 26  lyx                                 0x0000000108896d1b 
_ZN3lyx8frontend14GuiApplication6notifyEP7QObjectP6QEvent : 26  lyx 
                             0x0000000108896d1b 
_ZN3lyx8frontend14GuiApplication6notifyEP7QObjectP6QEvent + 21
( 27) 27  QtCore                              0x00000001091378a4 
_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent : 27  QtCore 
                            0x00000001091378a4 
_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 212
( 28) 28  QtWidgets                           0x000000010961d387 
_ZN19QApplicationPrivate14sendMouseEventEP7QWidgetP11QMouseEventS1_S1_PS1_R8QPointerIS0_Ebb 
: 28  QtWidgets                           0x000000010961d387 
_ZN19QApplicationPrivate14sendMouseEventEP7QWidgetP11QMouseEventS1_S1_PS1_R8QPointerIS0_Ebb 
+ 903
( 29) 29  QtWidgets                           0x00000001096763ef 
_ZN13QWidgetWindow16handleMouseEventEP11QMouseEvent : 29  QtWidgets 
                       0x00000001096763ef 
_ZN13QWidgetWindow16handleMouseEventEP11QMouseEvent + 1663
( 30) 30  QtWidgets                           0x00000001096750de 
_ZN13QWidgetWindow5eventEP6QEvent : 30  QtWidgets 
     0x00000001096750de _ZN13QWidgetWindow5eventEP6QEvent + 238
( 31) 31  QtWidgets                           0x000000010961ca69 
_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent : 31 
QtWidgets                           0x000000010961ca69 
_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 265
( 32) 32  QtWidgets                           0x000000010961de15 
_ZN12QApplication6notifyEP7QObjectP6QEvent : 32  QtWidgets 
              0x000000010961de15 
_ZN12QApplication6notifyEP7QObjectP6QEvent + 581
( 33) 33  lyx                                 0x0000000108896d1b 
_ZN3lyx8frontend14GuiApplication6notifyEP7QObjectP6QEvent : 33  lyx 
                             0x0000000108896d1b 
_ZN3lyx8frontend14GuiApplication6notifyEP7QObjectP6QEvent + 21
( 34) 34  QtCore                              0x00000001091378a4 
_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent : 34  QtCore 
                            0x00000001091378a4 
_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 212
( 35) 35  QtGui                               0x0000000109c8125b 
_ZN22QGuiApplicationPrivate17processMouseEventEPN29QWindowSystemInterfacePrivate10MouseEventE 
: 35  QtGui                               0x0000000109c8125b 
_ZN22QGuiApplicationPrivate17processMouseEventEPN29QWindowSystemInterfacePrivate10MouseEventE 
+ 3931
( 36) 36  QtGui                               0x0000000109c682cb 
_ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE 
: 36  QtGui                               0x0000000109c682cb 
_ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE 
+ 235
( 37) 37  libqcocoa.dylib                     0x000000010be92dd8 
_ZN28QCocoaEventDispatcherPrivate26postedEventsSourceCallbackEPv : 37 
libqcocoa.dylib                     0x000000010be92dd8 
_ZN28QCocoaEventDispatcherPrivate26postedEventsSourceCallbackEPv + 40
( 38) 38  CoreFoundation                      0x00007fff2f58bd52 
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ : 38 
CoreFoundation                      0x00007fff2f58bd52 
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
( 39) 39  CoreFoundation                      0x00007fff2f58bcf1 
__CFRunLoopDoSource0 : 39  CoreFoundation 
0x00007fff2f58bcf1 __CFRunLoopDoSource0 + 103
( 40) 40  CoreFoundation                      0x00007fff2f58bb0b 
__CFRunLoopDoSources0 : 40  CoreFoundation 
0x00007fff2f58bb0b __CFRunLoopDoSources0 + 209
( 41) 41  CoreFoundation                      0x00007fff2f58a83a 
__CFRunLoopRun : 41  CoreFoundation 
0x00007fff2f58a83a __CFRunLoopRun + 927
( 42) 42  CoreFoundation                      0x00007fff2f589e3e 
CFRunLoopRunSpecific : 42  CoreFoundation 
0x00007fff2f589e3e CFRunLoopRunSpecific + 462
( 43) 43  HIToolbox                           0x00007fff2e1b6abd 
RunCurrentEventLoopInMode : 43  HIToolbox 
0x00007fff2e1b6abd RunCurrentEventLoopInMode + 292
( 44) 44  HIToolbox                           0x00007fff2e1b66f4 
ReceiveNextEventCommon : 44  HIToolbox 
0x00007fff2e1b66f4 ReceiveNextEventCommon + 359
( 45) 45  HIToolbox                           0x00007fff2e1b6579 
_BlockUntilNextEventMatchingListInModeWithFilter : 45  HIToolbox 
                    0x00007fff2e1b6579 
_BlockUntilNextEventMatchingListInModeWithFilter + 64
( 46) 46  AppKit                              0x00007fff2c7fc039 
_DPSNextEvent : 46  AppKit 
0x00007fff2c7fc039 _DPSNextEvent + 883
( 47) 47  AppKit                              0x00007fff2c7fa880 
-[NSApplication: 47  AppKit 
0x00007fff2c7fa880 -[NSApplication(NSEvent) 
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
( 48) 48  AppKit                              0x00007fff2c7ec58e 
-[NSApplication run] : 48  AppKit 
0x00007fff2c7ec58e -[NSApplication run] + 658
( 49) 49  libqcocoa.dylib                     0x000000010be91c3d 
_ZN21QCocoaEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE 
: 49  libqcocoa.dylib                     0x000000010be91c3d 
_ZN21QCocoaEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE 
+ 2669
( 50) 50  QtCore                              0x0000000109133037 
_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE : 50  QtCore 
                         0x0000000109133037 
_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE + 439
( 51) 51  QtCore                              0x0000000109137ef2 
_ZN16QCoreApplication4execEv : 51  QtCore 
0x0000000109137ef2 _ZN16QCoreApplication4execEv + 130
( 52) 52  lyx                                 0x00000001085ddc20 
_ZN3lyx3LyX4execERiPPc : 52  lyx 
0x00000001085ddc20 _ZN3lyx3LyX4execERiPPc + 938
( 53) 53  lyx                                 0x00000001084caa8f main : 
53  lyx                                 0x00000001084caa8f main + 79
( 54) 54  libdyld.dylib                       0x00007fff695f6cc9 start : 
54  libdyld.dylib                       0x00007fff695f6cc9 start + 1


-- 
Daniel
-------------- next part --------------
diff --git a/src/frontends/qt/GuiCharacter.cpp b/src/frontends/qt/GuiCharacter.cpp
index d1d4336fc2..19f392eaac 100644
--- a/src/frontends/qt/GuiCharacter.cpp
+++ b/src/frontends/qt/GuiCharacter.cpp
@@ -26,6 +26,7 @@
 #include "ColorCache.h"
 #include "ColorSet.h"
 #include "Cursor.h"
+#include "GuiFontLoader.h"
 #include "FuncRequest.h"
 #include "Language.h"
 #include "Paragraph.h"
@@ -610,6 +611,8 @@ void GuiCharacter::setStrike(FontInfo & fi, FontDeco val)
 
 void GuiCharacter::paramsToDialog(Font const & font)
 {
+	FontInfo fi2 = font.fontInfo();
+	QFont qfont = getFont(fi2.realize(sane_font));
 	FontInfo const & fi = font.fontInfo();
 	familyCO->setCurrentIndex(findPos2nd(family, fi.family()));
 	seriesCO->setCurrentIndex(findPos2nd(series, fi.series()));


More information about the lyx-devel mailing list