Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1
-
@Volker75 said in Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1:
My header is wrong.
Don't know what this means.
because there is at least one bug in Qt or in libxcb.so.1.1.0.
Don't know what you are referring to. Don't think anyone can act on this. My understanding is that you reported signal not working, now you acknowledge it works, so don't know what bug you are referring to.
Can anyone report this well and hunt it down?
I don't see what others have to hunt down which is wrong, or why they would do so.
https://forum.qt.io/topic/160116/qtwebenginecore-dll-sometimes-not-found?_=1736677825304
I don't see why, whatever that turned out to be about, it is particularly related to anything else here. Especially if it is "intermittent".
To report a bug you need to have a small, complete piece of code which illustrates a problem. I think two other people have reported something like @ChrisW67's code seems to run fine, and you may be in that situation now, I don't know. I am not sure anyone will be interested in reports from valgrind necessarily counting as bugs, only if results in bad behaviour,
-
"My header" = not in the code. Header of this topic/post in the forum.
I am refereeing to the valgrind logfile that i added. Did you ever used valgrind? It is a very nice tool and you can hunt down bugs in your code very well. It shows you where the bug is located.
If you watch the logfile, then you can see where the bug is located. Sadly valgrind refer to files that are out of my scope. The bug is not in my source. The bug is in functions that I call only.As far as i can see and understand it, there is a wrong pointer (Quote from the log file: "vector[0]) points to uninitialized byte(s)".). It points to a wrong place and that is why the function doesn't do what it should do. It was only luck that is was running fine. Similar to the other bug that I report. It is the same software and the same code and there it crashes with Windows 10 Citrix and Qt 6.7.2 even the exact code is running fine on 10 other computers with Qt 6.7.2 (Windows, Linux, Windows 10 local, MacOS, ...). So there it was only just luck.
-
@Volker75
Yes, I have used valgrind many times. Yes, it can be a useful tool. Yes, it can always return false positives. No, I don't think anyone particularly will look into this, especially withQWebEngine
, unless some behaviour is demonstrably wrong. Which as I understand it you do not have. You still say "why the function doesn't do what it should do" but I haven't seen a consistent report of something going wrong, else the other guys would have said so, valgrind report apart. Maybe I'm mistaken and someone else will look into this, but I wouldn't hold your breath. -
In my source it crashes every time under Linux 6.8.1!
Sadly it is large and so you want to have a smaller file of course, but then he bug doesn't occur.
It is like if I use a Qt function like this:
qt_foo(myCode.size());And in this Qt function is source like this: (This is not the real source. Only a bad example):
a[10];
...
for(int i=0; i<x; i++)
sum+=a[i];
}and you tell me: "Ohh... Wait: Your example code is too large. You must do a smaller sample code and prove that it doesn't work. Nobody will check such a large example. Your sample code is only allowed to have a small example that doesn't work."
My source code is sadly large. I can't make my source code smaller. If I make my source code smaller, then it is just higher luck that the bug doesn't occur. -
@Volker75
This forum is a user from, for users of Qt just like yourself. It is not a The Qt Company forum. If you want to report a bug that is done at TQtC https://bugreports.qt.io/. I think you will find they want a small program which reproduces bad behaviour. I don't know that they will look at your larger existing application, but up to you.In my source it crashes every time under Linux 6.8.1!
I agree that is problematic. You might supply them with the stack trace on crash, which you have not shown us.
I pay 50€ to the guy that fix this bug.
LOL :)
-
-
Maybe am am not skilled enough with gdb.
I used gdb and used "r". And tried to get the crash.
Then I get this error:Thread 1 "Test" received signal SIGSEGV, Segmentation fault. Downloading source file /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp QWebEngineView::page (this=0x555556a22710) at /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp:1058 Warnung: 1058 /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp: Datei oder Verzeichnis nicht gefunden
It is translated: File or Folder not found
So similar to the bug that i descriped in the other topic that i linked a few posts ago.Please give me more advice what I can do to locate the bug.
-
Sorry, I forgot the bt stuff. I hope anyone understand it:
[Thread 0x7fff7cc006c0 (LWP 13329) exited] Thread 1 "Test" received signal SIGSEGV, Segmentation fault. Downloading source file /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp QWebEngineView::page (this=0x555556a22710) at /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp:1058 Warnung: 1058 /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp: Datei oder Verzeichnis nicht gefunden (gdb) bt #0 QWebEngineView::page (this=0x555556a22710) at /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp:1058 #1 0x00007ffff7f50f26 in QWebEngineView::setHtml (this=<optimized out>, html=<Fehler beim Lesen der Variable: Cannot access memory at address 0x7fffffffc038>, baseUrl=...) at /home/qt/work/qt/qtwebengine/src/webenginewidgets/api/qwebengineview.cpp:1102 #2 0x0000555555ae0436 in operator() (__closure=0x555556a59390) at src/timetableprintform.cpp:58 #3 0x0000555555ae0ced in operator() (__closure=0x7fffffffc120) at ../../../Qt6.8/6.8.1/gcc_64/include/QtCore/qobjectdefs_impl.h:141 #4 0x0000555555ae0d94 in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, TimetablePrintForm::TimetablePrintForm(QWidget*)::<lambda()> >::call(TimetablePrintForm::TimetablePrintForm(QWidget*)::<lambda()>&, void**)::<lambda()> >(void **, struct {...} &&) (args=0x7fffffffc258, fn=...) at ../../../Qt6.8/6.8.1/gcc_64/include/QtCore/qobjectdefs_impl.h:65 Backtrace stopped: Cannot access memory at address 0x7fffffffc108
-
Apologies for being a bit abrupt in my last post.
I have posted two pieces of code. The first was a simple one-widget form that looked a bit like the problem statement (and worked when the obvious other elements were added), and the second was a self-contained example that worked without addition. There was no intent that these were to be copied and pasted into anywhere as a solution.
Based on the backtrace I would start with the assumption that, at line 58 of your code, the
view
pointer is invalid (probably not null) at the time the slot/lambda executes. This could be because it is not initialised yet, the referenced object has been deleted, you have two variables calledview
with one (invalid) masking the other (valid) etc. -
Thank you very much for your answer!
hmm.. Since I also used your code in my project and your name of the view was different, it should not be a shadowing problem.In fact in my source I have a lot of similar names in different dialogs. In the main dialog and also in a sub dialog:
mainwindow.h class MainWindow : public QMainWindow { … QWebEngineView *viewPreview; … } mainwindow.cpp void MainWindow::printTimetable() { TimetablePrintForm dialog(this); if (dialog.exec()) { } ... }
This mainwindow executes the timetableprintform:
timetableprintform.h class TimetablePrintForm: public Qdialog{ { … QWebEngineView *viewPreview; … }
I renamed QWebEngineView *viewPreview; in the timetableprintform to an other name. The bug is still present. So it is not a shadowing problem of the view. :-(
But while coding it, it reminds me on an 12 years old TODO. Maybe that is producing the shadowing problem? I sadly don't know if my comment it true and how to fix it:
main.cpp ... QApplication* app=NULL; QTranslator TTranslator; ... int main(int argc, char *argv[]){ ... QApplication app(argc, argv); //TODO: QApplication shadows the global Qapplication? app.setApplicationName(NAME); app.setApplicationVersion(VERSION); ... if(TSettings->language==""){ selectLanguage(NULL); } setLanguage(app, NULL); ... if(TSettings->languageRTL) app.setLayoutDirection(Qt::RightToLeft); ... MainWindow mainWin(check); mainWin.show(); return app.exec(); }
Any advice? Thank you very much.
-
@Volker75 said in Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1:
QApplication app(argc, argv);
This is correct. QApplication instance is usually created in main() - there should not be any global instances of that class.
Did you address what @ChrisW67 wrote: "at line 58 of your code, the view pointer is invalid"? -
Thank you. I think I addressed that, since like I already wrote "I renamed QWebEngineView *viewPreview; in the timetableprintform to an other name. The bug is still present.". So the pointer got a new unique name. So there shouldn't be a shadowing.
Maybe I misunderstand you. Is there an other way to do? What should can I do? Just check if the pointer is !=NULL (But even if it is NULL, what should I do in that case?)? -
I coded now this:
if(viewPreview2==NULL){ qDebug("NULL"); } else { qDebug("Not NULL"); } viewPreview2->setHtml(updateHTMLprintString(true));
The last line is the problem.
Debug tells me "Not NULL" in the terminal.
Is there any thing else that I could check to locate the bug more detailed? -
Here are some things to try in your code:
TimetablePrintForm::TimetablePrintForm(QWidget *parent): QDialog(parent){ QVBoxLayout *layout = new QVBoxLayout(this); QWebEngineView *view = new QWebEngineView(this); qDebug() << "As constructed" << view; connect(view, &QWebEngineView::loadFinished, this, &TimetablePrintForm::loadFinished); layout->addWidget(view); QTimer::singleShot(0, [=](){ qDebug() << "In lambda 1" << view; view->setHtml("<html><head><title>Initial page</title></head><body><p>Initial content</p></body></html>"); } ); QTimer::singleShot(3000, [=](){ qDebug() << "In lambda 2" << view; view->setHtml("<html><head><title>Three seconds page</title></head><body><p>New content</p></body></html>"); } );
Do the three qDebugs print the same value?
What is the value ofview
in the slotTimetablePrintForm::loadFinished
?Replace QWebEngineView with a basic instrumented subclass (something like):
class MyWebEngineView: public QWebEngineView { Q_OBJECT public: explicit MyWebEngineView(QWidget *parent = nullptr) : QWebEngineView(parent) { qDebug() << "Constructing MyWebEngineView" << this; } ~MyWebEngineView() { qDebug() << "Destructing MyWebEngineView" << this; } };
Do you see constructions/destructions you were not expecting?
Matching pairs?When it crashes in your debugger, what is the complete backtrace?