Summary: | Kile crashes in Okular::Page::formFields() when rapidly switching between tabs using the keyboard shortcut | ||
---|---|---|---|
Product: | [Applications] kile | Reporter: | Nate Graham <nate> |
Component: | general | Assignee: | Michel Ludwig <michel.ludwig> |
Status: | REPORTED --- | ||
Severity: | crash | CC: | aacid, carl, etnguyen03+kdebugs |
Priority: | NOR | Keywords: | drkonqi |
Version: | master | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | New crash information added by DrKonqi |
Description
Nate Graham
2021-12-22 00:50:40 UTC
How do you do that? If I do Alt+Left/Right, only the text editor tab changes. The document view changes only when I click ViewPDF or ForwardPDF. It also does not crash if I do it faster than usual on my slowbook. ;) Yep. And when the text editor tab changes, the Okular-provided preview changes too. I should note that when I reproduce this, at least one of the tabs is a simple .txt file that doesn't get rendered by the Okularpart preview. It doesn't happen when all of the tabs contain .tex files. Maybe there's an "automatically reload preview" setting that I turned on ages ago. Either way, the Okularpart preview does update automatically for me when I switch tabs. it's re-entering the closeDocument method because you press the shortcuts faster than it takes for cancelling the running threads. If you can reproduce this easily you need to add a bool in document that is "i am closing" and then check it first thing in closedocument, if it's already closing just return, if not set it to true and then set it to false at the end of the function. Can you check if that helps? Nope, that doesn't fix it, assuming I did it right: diff --git core/document.cpp core/document.cpp index b6be827f1..9a80db24f 100644 --- core/document.cpp +++ core/document.cpp @@ -2486,10 +2486,12 @@ KXMLGUIClient *Document::guiClient() void Document::closeDocument() { - // check if there's anything to close... - if (!d->m_generator) + // check if there's anything to close or if we are already closing... + if (!d->m_generator || d->m_isClosing) return; + d->m_isClosing = true; + emit aboutToClose(); delete d->m_pageController; @@ -2639,6 +2641,7 @@ void Document::closeDocument() // see: https://sourceware.org/bugzilla/show_bug.cgi?id=14827 malloc_trim(0); #endif + d->m_isClosing = false; } void Document::addObserver(DocumentObserver *pObserver) diff --git core/document_p.h core/document_p.h index bd932db37..c8c93c47a 100644 --- core/document_p.h +++ core/document_p.h @@ -129,6 +129,7 @@ public: , m_annotationBeingModified(false) , m_docdataMigrationNeeded(false) , m_synctex_scanner(nullptr) + , m_isClosing(false) { calculateMaxTextPages(); } @@ -345,6 +346,8 @@ public: static QVector<KPluginMetaData> availableGenerators(); static QVector<KPluginMetaData> configurableGenerators(); static KPluginMetaData generatorForMimeType(const QMimeType &type, QWidget *widget, const QVector<KPluginMetaData> &triedOffers = QVector<KPluginMetaData>()); + + bool m_isClosing; }; class DocumentInfoPrivate That sounds like what i meant yes. What backtrace do you get now? Because previously you had two closeDocument in the backtrace that now should not be possible. Now this is the backtrace: Thread 1 "kile" received signal SIGSEGV, Segmentation fault. QMapNode<Okular::DocumentObserver const*, Okular::TilesManager*>::lowerBound (akey=<optimized out>, this=<optimized out>) at /usr/include/qt5/QtCore/qmap.h:155 155 n = n->leftNode(); (gdb) bt #0 QMapNode<Okular::DocumentObserver const*, Okular::TilesManager*>::lowerBound ( akey=<optimized out>, this=<optimized out>) at /usr/include/qt5/QtCore/qmap.h:155 #1 QMapData<Okular::DocumentObserver const*, Okular::TilesManager*>::findNode ( this=<optimized out>, this=<optimized out>, akey=<synthetic pointer>: <optimized out>) at /usr/include/qt5/QtCore/qmap.h:288 #2 QMap<Okular::DocumentObserver const*, Okular::TilesManager*>::value ( adefaultValue=<optimized out>, akey=<synthetic pointer>: <optimized out>, this=<optimized out>) at /usr/include/qt5/QtCore/qmap.h:665 #3 Okular::PagePrivate::tilesManager (this=<optimized out>, observer=0x186f620) at /home/nate/kde/src/okular/core/page.cpp:996 #4 0x00007fffd2daae7f in Okular::PixmapRequestPrivate::tilesManager (this=<optimized out>) at /home/nate/kde/src/okular/core/generator.cpp:657 #5 0x00007fffd2d91c42 in Okular::DocumentPrivate::sendGeneratorPixmapRequest (this=0x7fffcc002c00) at /home/nate/kde/src/okular/core/document.cpp:1290 #6 0x00007ffff5488726 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffd220, r=<optimized out>, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398 #7 QSingleShotTimer::timerEvent (this=0x541ca40) at kernel/qtimer.cpp:320 #8 0x00007ffff547bedf in QObject::event (this=0x541ca40, e=0x7fffffffd370) at kernel/qobject.cpp:1336 #9 0x00007ffff5f26443 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x541ca40, e=0x7fffffffd370) at kernel/qapplication.cpp:3632 #10 0x00007ffff54517d8 in QCoreApplication::notifyInternal2 (receiver=0x541ca40, event=0x7fffffffd370) at kernel/qcoreapplication.cpp:1064 #11 0x00007ffff54a1ea3 in QTimerInfoList::activateTimers (this=0x469380) at kernel/qtimerinfo_unix.cpp:643 #12 0x00007ffff54a27ac in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183 #13 0x00007ffff321005f in g_main_dispatch (context=0x46a7a0) at ../glib/gmain.c:3381 #14 g_main_context_dispatch (context=0x46a7a0) at ../glib/gmain.c:4099 #15 0x00007ffff3265298 in g_main_context_iterate.constprop.0 (context=context@entry=0x46a7a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4175 #16 0x00007ffff320d853 in g_main_context_iteration (context=0x46a7a0, may_block=1) at ../glib/gmain.c:4240 #17 0x00007ffff54a2bb8 in QEventDispatcherGlib::processEvents (this=0x46ad30, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #18 0x00007ffff54501e2 in QEventLoop::exec (this=this@entry=0x7fffffffd610, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #19 0x00007ffff5458724 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #20 0x00007ffff5897c40 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1860 #21 0x00007ffff5f263b9 in QApplication::exec () at kernel/qapplication.cpp:2824 #22 0x00007ffff7e32c1b in kdemain (argc=<optimized out>, argv=<optimized out>) at /home/nate/kde/src/kile/src/main.cpp:203 #23 0x00007ffff4768560 in __libc_start_call_main (main=main@entry=0x401040 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffd8d8) at ../sysdeps/nptl/libc_start_call_main.h:58 #24 0x00007ffff476860c in __libc_start_main_impl (main=0x401040 <main>, argc=1, argv=0x7fffffffd8d8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd8c8) at ../csu/libc-start.c:409 #25 0x0000000000401075 in _start () Not present in this second backtrace, but looking at the first one there's 4 nested calls to KileTool::LivePreviewManager::clearLivePreview. Wonder if this should actually be fixed in kile? Could be, so maybe there are two bugs? One in Okular and one in Kile? (In reply to Nate Graham from comment #9) > Could be, so maybe there are two bugs? One in Okular and one in Kile? I haven't looked at it properly so i'm just throwing random facts here, but if Kile is calling Okular::Part::closeUrl again over the same object before waiting for the previous Okular::Part::closeUrl call to finish, i'd say that's a Kile bug and not an Okular bug. Yes, that seems likely Created attachment 158215 [details]
New crash information added by DrKonqi
kile (2.9.93) using Qt 5.15.9
Rapidly scrolling between document tabls (i.e. using two-finger scroll/scrollwheel on the tabs) results in a segfault. I had autoview/autopreview enabled so it may be an issue with that?
-- Backtrace (Reduced):
#6 QHash<int, QHashDummyValue>::findNode (ahp=0x0, akey=<optimized out>, this=<error reading variable: Cannot access memory at address 0x10>) at /usr/include/qt/QtCore/qhash.h:940
#7 QHash<int, QHashDummyValue>::contains (akey=<optimized out>, this=<error reading variable: Cannot access memory at address 0x10>) at /usr/include/qt/QtCore/qhash.h:920
#8 QSet<int>::contains (value=<optimized out>, this=<optimized out>, this=<optimized out>, value=<optimized out>) at /usr/include/qt/QtCore/qset.h:97
#9 Okular::Generator::hasFeature (this=0x0, feature=Okular::Generator::SupportsCancelling) at /usr/src/debug/okular/okular-22.12.3/core/generator.cpp:427
#10 0x00007f6e07f661c5 in Okular::DocumentPrivate::clearAndWaitForRequests (this=0x55ea602ad0a0) at /usr/src/debug/okular/okular-22.12.3/core/document.cpp:2186
I can't reproduce this in the Qt6 version |