Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panini 0.73 segfaults immediately on startup #10

Closed
waltkelly opened this issue Mar 16, 2019 · 17 comments
Closed

panini 0.73 segfaults immediately on startup #10

waltkelly opened this issue Mar 16, 2019 · 17 comments
Assignees
Labels

Comments

@waltkelly
Copy link

It segfaults with both debug and release builds.

Commands to build:

$ make clean
$ make debug
$ ./panini /home/parz/Pictures/Images/Planets/Mars/PIA22908_fig1.jpg
$ ./panini /home/parz/Pictures/Images/Planets/Mars/PIA22908_fig1.jpg
qt5ct: using qt5ct plugin
Segmentation fault (core dumped)

ggdb backtrace:
segfault.txt

qmake generated Makefile (.txt extension added to be able to upload):
Makefile.txt

My system:

$ uname -a
Linux Manjusri 4.18.0-16-generic #17~18.04.1-Ubuntu SMP Tue Feb 12 13:35:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
@jubalh
Copy link
Member

jubalh commented Mar 17, 2019

Can you also upload the picture?
Which Qt version are you using?
Which desktop environment are you using?
Whats the output of echo $QT_QPA_PLATFORMTHEME ?

Somehow it seems to be related to the Qt theme that is set.

@jubalh jubalh self-assigned this Mar 17, 2019
@jubalh jubalh added the bug label Mar 17, 2019
@AdamMajer
Copy link

@waltkelly Do you see same crash if you do

./panini --platformtheme qgtk3 /home/parz/Pictures/Images/Planets/Mars/PIA22908_fig1.jpg

Since the segfault is in the setupUi(), which is autogenerated, it seems that there is a problem with your Qt install or the compiled application is not rebuilt properly. Remove all generated files and recompile would be first step.

@jubalh
Copy link
Member

jubalh commented Dec 11, 2019

Getting the same now on my system:

#0  0x00007ffff79d46b0 in QWidget::hide() () from /usr/lib64/libQt5Widgets.so.5
#1  0x00007ffff7b3810d in ?? () from /usr/lib64/libQt5Widgets.so.5
#2  0x00007ffff7b39531 in QMenuBar::heightForWidth(int) const ()
   from /usr/lib64/libQt5Widgets.so.5
#3  0x00007ffff7b3c529 in QMenuBar::changeEvent(QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#4  0x00007ffff79eaf54 in QWidget::event(QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#5  0x00007ffff7b3c5eb in QMenuBar::event(QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#6  0x00007ffff79a8c62 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /usr/lib64/libQt5Widgets.so.5
#7  0x00007ffff79b21e0 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#8  0x00007ffff6f76562 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    () from /usr/lib64/libQt5Core.so.5
#9  0x00007ffff79dcb30 in QWidget::changeEvent(QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#10 0x00007ffff7b3c48a in QMenuBar::changeEvent(QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#11 0x00007ffff79eaf54 in QWidget::event(QEvent*) ()
   from /usr/lib64/libQt5Widgets.so.5
#12 0x00007ffff7b3c5eb in QMenuBar::event(QEvent*) ()

@jubalh
Copy link
Member

jubalh commented Dec 17, 2019

@luis-pereira sorry for pinging you here. I know this is not LXQt ;) But I wanted to ask you if you see what's going on here?

@luis-pereira
Copy link

@jubalh Will take a quick look.

@luis-pereira
Copy link

@jubalh
Quick look
The crash is caused by the errMsgHandler() function. More specifically the QMessageBox::warning() or QMessage::critical() calls.

My guess is that your crash occurs when using qt5ct. Not qt5ct fault, tough. It's debug messages makes errMsgHandler() to be called and QMessage::warning() to be running triggering the crash.
To be certain, pls comment the QMessage::xxxxxxx in the errMsgHandler()and the crash should disappear.

@jubalh
Copy link
Member

jubalh commented Dec 17, 2019

Thank you for checking @luis-pereira !

To be certain, pls comment the QMessage::xxxxxxx in the errMsgHandler()and the crash should disappear.

You are right. It compiles and runs fine without those.
But I don't see why this is happening. And why did it work earlier?

@luis-pereira
Copy link

It's probably a combination of bad timing and the exec() call that QMessageBox static methods use.
QErrorMessage does not work for you ?

@luis-pereira
Copy link

Were you using qt5ct before ?

@jubalh
Copy link
Member

jubalh commented Dec 18, 2019

Were you using qt5ct before ?

I'm not sure. I never decided on using the one or the other consciously.
I'm not even sure where to set this. Probably this is just my Linux distro that set it for me?

@luis-pereira
Copy link

It's an environment variable.
echo ${QT_QPA_PLATFORMTHEME}

@jubalh
Copy link
Member

jubalh commented Dec 18, 2019

Yes it's set to qt5ct:

echo ${QT_QPA_PLATFORMTHEME}
qt5ct

But I don't know what/where it was set. And what other values I should use. And I suppose I should change Panini so it works with whatever value is set there.

@luis-pereira
Copy link

But I don't know what/where it was set. And what other values I should use. And I suppose I should change Panini so it works with whatever value is set there.

Of course.
It's set by the start environment. In LXQt case, it's starlxqt. You can override it by exporting some other value to the QT_QPA_PLATFORMTHEME. Or for a single run with, for example: QT_QPA_PLATFORMTHEME=lxqt ./panini
I'm just trying to see if it's a Qt regression. I don't think so.

Why was QErrorMessage not used ?

@jubalh
Copy link
Member

jubalh commented Dec 18, 2019

Why was QErrorMessage not used ?

I suppose there was no reason.

I could use:

-        QMessageBox::critical( 0, "pvQt", s );
+        errorMessageDialog = new QErrorMessage();
+        errorMessageDialog->showDialog(s);

But I think QErrorMessage(this) is needed and it's a static method, no?
Also I don't see a way to set criticial/warning right now.

@luis-pereira
Copy link

This should work:

diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index f376161..c68cd5d 100755
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -18,6 +18,7 @@
 */
 
 #include <QtGui>
+#include <QErrorMessage>
 #include <QSettings>
 #include <QMessageBox>
 #include "MainWindow.h"
@@ -32,20 +33,22 @@
 static void errMsgHandler( QtMsgType type, const QMessageLogContext &context, const QString &msg){
     QString s;
     bool die = false;
+    QErrorMessage *errorMessage = new QErrorMessage(nullptr);
+    errorMessage->setModal(true);
 
     switch( type ){
     case QtDebugMsg:
         s = "Debug: ";
     case QtWarningMsg:
         s += msg;
-        QMessageBox::warning( 0, "pvQt", s );
+        errorMessage->showMessage(s, "pvQt");
         break;
     case QtFatalMsg:
         die = true;
         s = "Fatal: ";
     case QtCriticalMsg:
         s += msg;
-        QMessageBox::critical( 0, "pvQt", s );
+        errorMessage->showMessage(s, "pvQt");
         break;
     }

@luis-pereira
Copy link

You can also use QMessageBox, but not the static methods.

@jubalh
Copy link
Member

jubalh commented Dec 19, 2019

Thanks @luis-pereira !
I tried:

diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index f376161..73666af 100755
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -33,19 +33,21 @@ static void errMsgHandler( QtMsgType type, const QMessageLogContext &context, co
     QString s;
     bool die = false;
 
+    QMessageBox *err = new QMessageBox(nullptr);
+
     switch( type ){
     case QtDebugMsg:
         s = "Debug: ";
     case QtWarningMsg:
         s += msg;
-        QMessageBox::warning( 0, "pvQt", s );
+        err->warning( 0, "pvQt", s );
         break;
     case QtFatalMsg:
         die = true;
         s = "Fatal: ";
     case QtCriticalMsg:
         s += msg;
-        QMessageBox::critical( 0, "pvQt", s );
+        err->critical( 0, "pvQt", s );
         break;
     }

too. But this one segfaulted also.

But your solution works fine! :)

@jubalh jubalh closed this as completed in bcb308c Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants