Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1
-
-
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?
-
Thank you very much! I am using Qt 6.8.1:
Terminal:15 As constructed QWebEngineView(0x5beb9e2e2120) In lambda 1 QWebEngineView(0x5beb9e2e2120) 15 Speicherzugriffsfehler (Speicherabzug geschrieben)
"Speicherzugriffsfehler" = segmentation fault
"15" that is a debug information from my mainwindow.cpp file; not from the timetableprintform.cpp file.Debuginfod has been enabled. To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit. Downloading separate debug info for system-supplied DSO at 0x7ffff7fc3000 Downloading separate debug info for /home/volker/Dokumente/TMP-to-publish/TiTiTo/libSimpleMail2Qt6.so.0 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6PrintSupport.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Widgets.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Gui.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Sql.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Network.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6QuickWidgets.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6WebChannel.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Positioning.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Quick.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6OpenGL.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6QmlMeta.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6QmlModels.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6QmlWorkerScript.so.6 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Qml.so.6 Downloading separate debug info for /lib/x86_64-linux-gnu/libglib-2.0.so.0 Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libglib-2.0.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libglib-2.0.so.0 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6DBus.so.6 Downloading separate debug info for /lib/x86_64-linux-gnu/libfreetype.so.6 Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgthread-2.0.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libgthread-2.0.so.0 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libicui18n.so.73 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libicuuc.so.73 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/lib/libicudata.so.73 Downloading separate debug info for /lib/x86_64-linux-gnu/libsmime3.so Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libsmime3.so Downloading separate debug info for /lib/x86_64-linux-gnu/libsmime3.so Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libnss3.so Downloading separate debug info for /lib/x86_64-linux-gnu/libnss3.so Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libnssutil3.so Downloading separate debug info for /lib/x86_64-linux-gnu/libnssutil3.so Downloading separate debug info for /lib/x86_64-linux-gnu/libplds4.so Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libplds4.so Downloading separate debug info for /lib/x86_64-linux-gnu/libplds4.so Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libplc4.so Downloading separate debug info for /lib/x86_64-linux-gnu/libplc4.so Downloading separate debug info for /lib/x86_64-linux-gnu/libnspr4.so Downloading separate debug info for /lib/x86_64-linux-gnu/libXrandr.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libexpat.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libdrm.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libXi.so.6 Downloading separate debug info for /lib/x86_64-linux-gnu/libasound.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libgbm.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libpcre2-8.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libpng16.so.16 Downloading separate debug info for /lib/x86_64-linux-gnu/libwayland-server.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-randr.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libcap.so.2 Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libcap.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libcap.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libgcrypt.so.20 Downloading separate debug info for /lib/x86_64-linux-gnu/libbsd.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libgpg-error.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libmd.so.0 Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/platforms/libqxcb.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-shm.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-sync.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-render.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-shape.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-xkb.so.1 [New Thread 0x7fffe58006c0 (LWP 19381)] [New Thread 0x7fffe4e006c0 (LWP 19382)] Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-glx.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libGLX_mesa.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libglapi.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-dri2.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-dri3.so.0 Downloading separate debug info for /lib/x86_64-linux-gnu/libxcb-present.so.0 Downloading separate debug info for /usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so Downloading separate debug info for /lib/x86_64-linux-gnu/libLLVM-17.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libsensors.so.5 Downloading separate debug info for /lib/x86_64-linux-gnu/libdrm_radeon.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libelf.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libdrm_amdgpu.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libdrm_nouveau.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libdrm_intel.so.1 Downloading separate debug info for /lib/x86_64-linux-gnu/libedit.so.2 Downloading separate debug info for /lib/x86_64-linux-gnu/libtinfo.so.6 Warnung: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libtinfo.so.6 Downloading separate debug info for /lib/x86_64-linux-gnu/libtinfo.so.6 Downloading separate debug info for /lib/x86_64-linux-gnu/libxml2.so.2 [New Thread 0x7fffddc006c0 (LWP 19383)] [New Thread 0x7fffdd2006c0 (LWP 19384)] [New Thread 0x7fffce8006c0 (LWP 19385)] [New Thread 0x7fffcde006c0 (LWP 19386)] [New Thread 0x7fffcd4006c0 (LWP 19387)] [New Thread 0x7fffcca006c0 (LWP 19388)] [New Thread 0x7fffc7e006c0 (LWP 19389)] [New Thread 0x7fffc74006c0 (LWP 19390)] [New Thread 0x7fffc6a006c0 (LWP 19391)] Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/iconengines/libqsvgicon.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/iconengines/../../lib/libQt6Svg.so.6 [New Thread 0x7fffc60006c0 (LWP 19392)] [New Thread 0x7fffc56006c0 (LWP 19393)] /home/volker/Dokumente/TMP-to-publish/TiTiTo/TiTiTo Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/sqldrivers/libqsqlite.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/imageformats/libqgif.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/imageformats/libqjpeg.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/imageformats/libqico.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/imageformats/libqsvg.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/tls/libqcertonlybackend.so Downloading separate debug info for /home/volker/Qt6.8/6.8.1/gcc_64/plugins/tls/libqopensslbackend.so [New Thread 0x7fffbbe006c0 (LWP 19397)] [New Thread 0x7fffbb4006c0 (LWP 19398)] [New Thread 0x7fffbaa006c0 (LWP 19399)] [Thread 0x7fffbaa006c0 (LWP 19399) exited] [Thread 0x7fffbb4006c0 (LWP 19398) exited] [Thread 0x7fffbbe006c0 (LWP 19397) exited] [New Thread 0x7fffbbe006c0 (LWP 19400)] [New Thread 0x7fffbb4006c0 (LWP 19401)] [New Thread 0x7fffbaa006c0 (LWP 19402)] [Thread 0x7fffbaa006c0 (LWP 19402) exited] [Thread 0x7fffbb4006c0 (LWP 19401) exited] [Thread 0x7fffbbe006c0 (LWP 19400) exited] [New Thread 0x7fffbbe006c0 (LWP 19403)] [Detaching after fork from child process 19404] [Detaching after fork from child process 19405] [Detaching after fork from child process 19406] [New Thread 0x7fffbb4006c0 (LWP 19407)] [New Thread 0x7fffbaa006c0 (LWP 19408)] [New Thread 0x7fffb8a006c0 (LWP 19409)] [New Thread 0x7fffafe006c0 (LWP 19410)] [New Thread 0x7fffaf4006c0 (LWP 19411)] [New Thread 0x7fffaea006c0 (LWP 19412)] [New Thread 0x7fffae0006c0 (LWP 19413)] [New Thread 0x7fffad6006c0 (LWP 19414)] [New Thread 0x7fffa3e006c0 (LWP 19423)] [New Thread 0x7fffacc006c0 (LWP 19422)] [New Thread 0x7fffa34006c0 (LWP 19424)] [New Thread 0x7fffa2a006c0 (LWP 19425)] [New Thread 0x7fffa20006c0 (LWP 19426)] [New Thread 0x7fffa0c006c0 (LWP 19428)] [New Thread 0x7fffa16006c0 (LWP 19427)] [New Thread 0x7fff97e006c0 (LWP 19429)] [New Thread 0x7fff974006c0 (LWP 19430)] [New Thread 0x7fff96a006c0 (LWP 19431)] [New Thread 0x7fff960006c0 (LWP 19432)] [New Thread 0x7fff956006c0 (LWP 19433)] [New Thread 0x7fff94c006c0 (LWP 19434)] [New Thread 0x7fff8be006c0 (LWP 19435)] [Thread 0x7fff8be006c0 (LWP 19435) exited] [Thread 0x7fff94c006c0 (LWP 19434) exited] [Thread 0x7fff956006c0 (LWP 19433) exited] [New Thread 0x7fff956006c0 (LWP 19436)] [New Thread 0x7fff94c006c0 (LWP 19437)] [New Thread 0x7fff8be006c0 (LWP 19438)] [Thread 0x7fff8be006c0 (LWP 19438) exited] [Thread 0x7fff94c006c0 (LWP 19437) exited] [Thread 0x7fff956006c0 (LWP 19436) exited] [New Thread 0x7fff956006c0 (LWP 19439)] [New Thread 0x7fff94c006c0 (LWP 19440)] [New Thread 0x7fff8be006c0 (LWP 19441)] 15 [New Thread 0x7fff8b4006c0 (LWP 19454)] [New Thread 0x7fff8aa006c0 (LWP 19455)] [New Thread 0x7fff8a0006c0 (LWP 19456)] [New Thread 0x7fff890006c0 (LWP 19457)] [New Thread 0x7fff7fe006c0 (LWP 19458)] [New Thread 0x7fff7f4006c0 (LWP 19459)] [New Thread 0x7fff7ea006c0 (LWP 19460)] As constructed QWebEngineView(0x5555569866f0) In lambda 1 QWebEngineView(0x5555569866f0) [New Thread 0x7fff7e0006c0 (LWP 19466)] [New Thread 0x7fff7d6006c0 (LWP 19467)] [New Thread 0x7fff7cc006c0 (LWP 19469)] [New Thread 0x7fff73e006c0 (LWP 19470)] [New Thread 0x7fff734006c0 (LWP 19471)] [Thread 0x7fff734006c0 (LWP 19471) exited] [Thread 0x7fff73e006c0 (LWP 19470) exited] [Thread 0x7fff7cc006c0 (LWP 19469) exited] [New Thread 0x7fff7cc006c0 (LWP 19472)] [New Thread 0x7fff73e006c0 (LWP 19473)] [New Thread 0x7fff734006c0 (LWP 19474)] [New Thread 0x7fff72a006c0 (LWP 19480)] [New Thread 0x7fff720006c0 (LWP 19481)] [New Thread 0x7fff716006c0 (LWP 19482)] [Thread 0x7fff716006c0 (LWP 19482) exited] [Thread 0x7fff720006c0 (LWP 19481) exited] [Thread 0x7fff72a006c0 (LWP 19480) exited] 15 [Thread 0x7fff734006c0 (LWP 19474) exited] [Thread 0x7fff73e006c0 (LWP 19473) exited] [Thread 0x7fff7cc006c0 (LWP 19472) exited] Thread 1 "Test" received signal SIGSEGV, Segmentation fault. 0x0000555556c0ace0 in ?? () (gdb) bt #0 0x0000555556c0ace0 in ?? () #1 0x00007ffff77da635 in operator<<(QDebug, QWidget const*) () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Widgets.so.6 #2 0x0000555555ae065f in operator() (__closure=0x555556ab0a20) at src/timetableprintform.cpp:52 #3 0x0000555555ae10a7 in operator() (__closure=0x7fffffffc120) at ../../../Qt6.8/6.8.1/gcc_64/include/QtCore/qobjectdefs_impl.h:141 #4 0x0000555555ae114e 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 #5 0x0000555555ae10ec in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, TimetablePrintForm::TimetablePrintForm(QWidget*)::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x7fffffffc258) at ../../../Qt6.8/6.8.1/gcc_64/include/QtCore/qobjectdefs_impl.h:140 #6 0x0000555555ae1011 in QtPrivate::FunctorCallable<TimetablePrintForm::TimetablePrintForm(QWidget*)::<lambda()> >::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7fffffffc258) at ../../../Qt6.8/6.8.1/gcc_64/include/QtCore/qobjectdefs_impl.h:362 #7 0x0000555555ae0f90 in QtPrivate::QCallableObject<TimetablePrintForm::TimetablePrintForm(QWidget*)::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x555556ab0a10, r=0x555556ab0230, a=0x7fffffffc258, ret=0x0) at ../../../Qt6.8/6.8.1/gcc_64/include/QtCore/qobjectdefs_impl.h:572 #8 0x00007ffff5fde038 in ?? () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 #9 0x00007ffff5feb33e in ?? () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 #10 0x00007ffff5fd1e75 in QObject::event(QEvent*) () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 #11 0x00007ffff77903f6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Widgets.so.6 #12 0x00007ffff5f7bcaa in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 #13 0x00007ffff6129b4a in QTimerInfoList::activateTimers() () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 #14 0x00007ffff625570c in ?? () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Core.so.6 #15 0x00007fffe95145b5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
timetableprintform.cpp:52 is:
qDebug() << "In lambda 2" << view;
I am not sure where I must do "Replace QWebEngineView with a basic instrumented subclass". That is a bit over my skill level. I will try it and report in a few minutes.
-
ahh.. Sorry. Now I understand why your code in my project do the semention fault.
TimetablePrintForm::~TimetablePrintForm() { qDebug("~TimetablePrintForm"); }
give me:
15 As constructed QWebEngineView(0x5977e8b2e040) In lambda 1 QWebEngineView(0x5977e8b2e040) 15 ~TimetablePrintForm Speicherzugriffsfehler (Speicherabzug geschrieben)
I am so sorry for that :-(
I sadly still don't get why my source doesn't work, because with my source I don't close the dialog. It closes only if I press a "close" button. So my code still doesn't emit the loadFinished signal with Qt 6.8.1; but with 6.7.2. -
@ChrisW67 said in Looks like the SIGNAL loadFinished(bool) is not emitted anymore with Qt 6.8.1:
~MyWebEngineView() { qDebug() << "Destructing MyWebEngineView" << this; }
I don't mean to detract from the diagnosis attempt, but I think it is actually causing its own problem/seg fault?
If you scroll through to the last backtrace we have been given in https://forum.qt.io/post/818795 we come across:
Thread 1 "Test" received signal SIGSEGV, Segmentation fault. 0x0000555556c0ace0 in ?? () (gdb) bt #0 0x0000555556c0ace0 in ?? () #1 0x00007ffff77da635 in operator<<(QDebug, QWidget const*) () from /home/volker/Qt6.8/6.8.1/gcc_64/lib/libQt6Widgets.so.6 #2 0x0000555555ae065f in operator() (__closure=0x555556ab0a20) at src/timetableprintform.cpp:52
This looks to me like the
this
in the destructor codeqDebug() << "Destructing MyWebEngineView" << this;
is aQWidget const*
and it is actually dying/segging on trying to fetch whatever fromthis
is wanted forqDebug()
? So although you can accessthis
in a destructor I wonder what state theQWidget
is in forqDebug()
at this point?@Volker75
You might want to change that line to justqDebug() << "Destructing MyWebEngineView";
(so nothis
) and see if that changes the backtrace to where whatever you real problem is. -
About the "Replace QWebEngineView with a basic instrumented subclass".
I think now unneeded for your code, since it was sadly my bug and I understand that problem now.
But that trick might help to locate the bug in my source.
I am sadly not clever enough to compile, since the linker complains:timetableprintform.cpp:(.text._ZN15MyWebEngineViewC2EP7QWidget[_ZN15MyWebEngineViewC5EP7QWidget]+0x2e): undefined reference to `vtable for MyWebEngineView'
But that is of course only because my skill level is too low to do that trick. Maybe you can give me a hint? (I added the "class MyWebEngineView" source and only replaced "QWebEngineView" by "MyWebEngineView".)
-
With my code, that is working fine with Qt 6.7.2, I can see that Qt 6.8.1 closes the printdialog as soon as I call setHtmlPreview:
15 setEnabled Preview setHtml Preview 15 ~TimetablePrintForm 15
hmm... Why does it deconstruct the printdialog. There is no reason for this. In Qt 6.7.2 it waits for user input (Since the user might print other tables. They must press pushbutton "close" or "X" the window to quit. So it quits automatically now before displaying the preview)
-
Thank you.
@JonB : I am sadly not clever enough. Source looks like this now:// #include <QtGlobal> #include <QtWidgets> //#ifdef Q_OS_WIN //nothing. Maybe the stuff from QPrintDialog?! //#else #include <QWebEngineView> //#endif #include "timetableprintform.h" #include <QString> #include <QStringList> #include <QSet> #include <QList> #include <QtSql> #include <QVBoxLayout> #include <QDebug> #include <QTimer> #ifdef QT_NO_PRINTER static QMap<QString, int> paperSizesMap; #else static QMap<QString, QPageSize> paperSizesMap; #endif // this is very similar to statisticsexport.cpp. so please also check there if you change something here! class MyWebEngineView: public QWebEngineView { Q_OBJECT public: explicit MyWebEngineView(QWidget *parent = nullptr) : QWebEngineView(parent) { qDebug() << "Constructing MyWebEngineView"; } ~MyWebEngineView() { qDebug() << "Destructing MyWebEngineView"; } }; TimetablePrintForm::TimetablePrintForm(QWidget *parent): QDialog(parent){ QVBoxLayout *layout = new QVBoxLayout(this); MyWebEngineView *view = new MyWebEngineView(this); qDebug() << "As constructed" << view; connect(view, &MyWebEngineView::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>"); } ); } TimetablePrintForm::~TimetablePrintForm() { qDebug("~TimetablePrintForm"); } void TimetablePrintForm::loadFinished(bool ok) { qDebug() << Q_FUNC_INFO << ok; qDebug("loadDinished"); } //#endif
But i can't compile, since the linker tells me:
timetableprintform.cpp:(.text+0x557): undefined reference to `vtable for MyWebEngineView' collect2: error: ld returned 1 exit status