tags 853801 + patch thanks On Tue, Jan 31, 2017 at 08:19:18PM -0500, Frédéric Brière wrote: > Left-clicking on the systray icon (or on the main window with --notray) > immediately triggers a segfault: > > #1 0x00005616b57ba023 in QString::~QString() (this=0x7ffd91e48d50, > __in_chrg=<optimized out>) at /usr/include/qt4/QtCore/qstring.h:880 > #2 0x00005616b57ba023 in LayoutEdit::LayoutEdit(LayoutManager*) > (this=0x5616b67266f0, l=<optimized out>) at layout_edit.cpp:50
This is due to fix_ftbfs_clang.patch (#752125), which replaces a proper array of objects with a malloc'ed blob that is a) never freed, and b) never initialized. Therefore, at layout_edit.cpp:50, QString::operator= gets passed some random garbage as argument, with fairly predictable results. Here's a replacement patch that uses std::vector, as suggested by the Clang documentation.
>From 96c9052c9d2033320019947035dcd3869b076f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbri...@fbriere.net> Date: Fri, 17 Mar 2017 15:32:15 -0400 Subject: [PATCH] Properly fix #752125 (closes #853801) --- src/layout_edit.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/layout_edit.cpp b/src/layout_edit.cpp index 8365104..5703ee3 100644 --- a/src/layout_edit.cpp +++ b/src/layout_edit.cpp @@ -1,4 +1,5 @@ #include "layout_edit.h" +#include <vector> //build the dialog LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) { @@ -39,7 +40,7 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) { //this is only necesary since joystick devices need not always be //contiguous int padcount = available.count(); - QString names[padcount]; + std::vector<QString> names(padcount); int i = 0; do { @@ -54,7 +55,7 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) { } while (0); //flash radio array - JoyButtons = new FlashRadioArray(padcount, names, true, this ); + JoyButtons = new FlashRadioArray(padcount, &names[0], true, this ); LMain->addWidget( JoyButtons ); //we have a WidgetStack to represent the multiple joypads @@ -119,7 +120,7 @@ void LayoutEdit::updateJoypadWidgets() { int indexOfFlashRadio = LMain->indexOf(JoyButtons); FlashRadioArray *newJoyButtons; int padcount = available.count(); - QString names[padcount]; + std::vector<QString> names(padcount); int i = 0; do { @@ -132,7 +133,7 @@ void LayoutEdit::updateJoypadWidgets() { } } while (0); - newJoyButtons = new FlashRadioArray(padcount, names, true, this ); + newJoyButtons = new FlashRadioArray(padcount, &names[0], true, this ); LMain->insertWidget(indexOfFlashRadio, newJoyButtons); LMain->removeWidget(JoyButtons); FlashRadioArray* oldJoyButtons = JoyButtons; -- 2.11.0