Skip to content

community/fcitx5-qt: build with -O2 CXXFLAGS

Lindsay Zhou requested to merge lindsay/aports:fcitx5-qt-O2 into master

When changing fcitx5 hotkeys, fcitx5-config-qt segfaults at fcitx5-qt/qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp#L497 when releasing a modifier key:

GDB logs

$ gdb fcitx5-config-qt
GNU gdb (GDB) 15.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
    .
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from fcitx5-config-qt...
(No debugging symbols found in fcitx5-config-qt)
(gdb) start
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n])
Starting program: /usr/bin/fcitx5-config-qt
[New LWP 21348]
[New LWP 21349]
[New LWP 21350]
[New LWP 21351]
[New LWP 21352]
[New LWP 21353]
[New LWP 21354]
[New LWP 21355]
[New LWP 21356]
[New LWP 21357]
[New LWP 21358]
The cached device pixel ratio value was stale on window update.  Please file a QTBUG which explains how to reproduce.
Thread 1 "fcitx5-config-q" received signal SIGSEGV, Segmentation fault.
0x00007ffff7efc2bb in QtPrivate::QGenericArrayOpsfcitx::Key::moveAppend(fcitx::Key*, fcitx::Key*) () from /usr/lib/libFcitx5Qt6WidgetsAddons.so.2
(gdb) bt
#0  0x00007ffff7efc2bb in QtPrivate::QGenericArrayOpsfcitx::Key::moveAppend(fcitx::Key*, fcitx::Key*) () from /usr/lib/libFcitx5Qt6WidgetsAddons.so.2
#1  0x00007ffff7eff883 in fcitx::FcitxQtKeySequenceButton::keyReleaseEvent(QKeyEvent*) () from /usr/lib/libFcitx5Qt6WidgetsAddons.so.2
#2  0x00007ffff73ae677 in QWidget::event(QEvent*) () from /usr/lib/libQt6Widgets.so.6
#3  0x00007ffff735cd38 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#4  0x00007ffff7361332 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#5  0x00007ffff61806f8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#6  0x00007ffff73c7c8b in ?? () from /usr/lib/libQt6Widgets.so.6
#7  0x00007ffff735cd38 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#8  0x00007ffff61806f8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#9  0x00007ffff69b145c in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/libQt6Gui.so.6
#10 0x00007ffff6a1af25 in QWindowSystemInterface::sendWindowSystemEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/lib/libQt6Gui.so.6
#11 0x00007ffff6e58ee5 in ?? () from /usr/lib/libQt6Gui.so.6
#12 0x00007ffff66c800e in ?? () from /usr/lib/libglib-2.0.so.0
#13 0x00007ffff66cb2c7 in ?? () from /usr/lib/libglib-2.0.so.0
#14 0x00007ffff66cba2e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#15 0x00007ffff63d4765 in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/lib/libQt6Core.so.6
#16 0x00007ffff6182023 in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/lib/libQt6Core.so.6
#17 0x00007ffff618251d in QCoreApplication::exec() () from /usr/lib/libQt6Core.so.6
#18 0x0000555555574132 in ?? ()
#19 0x00007ffff7f9a496 in libc_start_main_stage2 (main=0x555555574030, argc=1, argv=0x7fffffffe418) at src/env/__libc_start_main.c:95
#20 0x00005555555741e6 in ?? ()
#21 0x0000000000000001 in ?? ()
#22 0x00007fffffffe7a6 in ?? ()
#23 0x0000000000000000 in ?? ()

Can't reproduce if build fcitx5-qt with -O2 CXXFLAGS.

Also can be fixed by replacing

d->keySequence_ = QList<Key>({key});

with

d->keySequence_ = QList<Key>() << key;

I think it's compiler's over-optimization.

Package size increasement(x86_64):

  • fcitx5-qt-qt5: 507 KiB -> 627 KiB
  • fcitx5-qt-qt6: 674 KiB -> 862 KiB

Merge request reports

Loading