Summary: | words crashes when closing it while document is loading | ||
---|---|---|---|
Product: | [Applications] calligrawords | Reporter: | Halla Rempt <halla> |
Component: | general | Assignee: | Calligra Words Bugs <calligra-words-bugs-null> |
Status: | RESOLVED UNMAINTAINED | ||
Severity: | crash | CC: | hlovdal, hrvoje.senjan, lassi.ta.nieminen, mail, ogldelphi, sebsauer |
Priority: | NOR | ||
Version: | 2.4-snapshots | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Halla Rempt
2011-06-06 20:08:15 UTC
The reason is that the KoMainWindow got destroyed without the KWDocument knowing about it and therefore if it tries to access something that was owned by the KoMainWindow it crashes. The KoMainWindow tries to detach the KoDocument in it's ctor but the problem is that the KoDocument got only added to the KoMainWindow once loading is completed. backtrace with symbols; Application: Words (words), signal: Segmentation fault [KCrash Handler] #6 0xb76cbd78 in KoMainWindow::slotProgress (this=0x81e3d10, value=91) at /home/kdab/src/kde/calligra/libs/main/KoMainWindow.cpp:1553 #7 0xb769a5ff in (anonymous namespace)::DocumentProgressProxy::setValue (this=0x832dc40, value=91) at /home/kdab/src/kde/calligra/libs/main/KoDocument.cpp:322 #8 0xb770ee40 in KoProgressUpdater::updateUi (this=0x833b828) at /home/kdab/src/kde/calligra/libs/main/KoProgressUpdater.cpp:206 #9 0xb770f1ee in KoProgressUpdater::qt_metacall (this=0x833b828, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0xbfde771c) at /home/kdab/src/build/calligra/libs/main/KoProgressUpdater.moc:74 #10 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #11 0xb56bfa2c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4 #12 0xb570efe5 in QTimer::timeout() () from /usr/lib/libQtCore.so.4 #13 0xb56c6046 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/libQtCore.so.4 #14 0xb56be3f4 in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4 #15 0xb5c9e414 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4 #16 0xb5ca70c7 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4 #17 0xb674e1f1 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5 #18 0xb56a8fde in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4 #19 0xb56da379 in ?? () from /usr/lib/libQtCore.so.4 #20 0xb56d7042 in ?? () from /usr/lib/libQtCore.so.4 #21 0xb45b3509 in g_main_context_dispatch () from /lib/libglib-2.0.so.0 #22 0xb45b3d10 in ?? () from /lib/libglib-2.0.so.0 #23 0xb45b3fce in g_main_context_iteration () from /lib/libglib-2.0.so.0 #24 0xb56d776b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4 #25 0xb5d5455a in ?? () from /usr/lib/libQtGui.so.4 #26 0xb56ad153 in QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4 #27 0xb770ebd5 in KoProgressUpdater::update (this=0x833b828) at /home/kdab/src/kde/calligra/libs/main/KoProgressUpdater.cpp:163 #28 0xb770f1e1 in KoProgressUpdater::qt_metacall (this=0x833b828, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfde7f7c) at /home/kdab/src/build/calligra/libs/main/KoProgressUpdater.moc:73 #29 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #30 0xb56bfa2c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4 #31 0xb7710c15 in KoUpdaterPrivate::sigUpdated (this=0x828a2e0) at /home/kdab/src/build/calligra/libs/main/KoUpdaterPrivate_p.moc:95 #32 0xb7710a85 in KoUpdaterPrivate::setProgress (this=0x828a2e0, percent=28) at /home/kdab/src/kde/calligra/libs/main/KoUpdaterPrivate_p.cpp:45 #33 0xb7710bd0 in KoUpdaterPrivate::qt_metacall (this=0x828a2e0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0xbfde80c8) at /home/kdab/src/build/calligra/libs/main/KoUpdaterPrivate_p.moc:84 #34 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #35 0xb56bfa2c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4 #36 0xb7710648 in KoUpdater::sigProgress (this=0x82f88e8, _t1=28) at /home/kdab/src/build/calligra/libs/main/KoUpdater.moc:102 #37 0xb7710352 in KoUpdater::setProgress (this=0x82f88e8, percent=28) at /home/kdab/src/kde/calligra/libs/main/KoUpdater.cpp:61 #38 0xb046fe2a in KWDocument::layoutProgressChanged (this=0x8207a60, percent=28) at /home/kdab/src/kde/calligra/words/part/KWDocument.cpp:356 #39 0xb045f29f in KWDocument::qt_metacall (this=0x8207a60, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfde8248) at /home/kdab/src/build/calligra/words/part/moc_KWDocument.cpp:110 #40 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #41 0xb56bfa2c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4 #42 0xb5026204 in KoTextDocumentLayout::layoutProgressChanged (this=0x90b1700, _t1=28) at /home/kdab/src/build/calligra/libs/textlayout/KoTextDocumentLayout.moc:101 #43 0xb5025fa2 in KoTextDocumentLayout::updateProgress (this=0x90b1700, it=...) at /home/kdab/src/kde/calligra/libs/textlayout/KoTextDocumentLayout.cpp:750 #44 0xb5025970 in KoTextDocumentLayout::doLayout (this=0x90b1700) at /home/kdab/src/kde/calligra/libs/textlayout/KoTextDocumentLayout.cpp:630 #45 0xb5024faa in KoTextDocumentLayout::layout (this=0x90b1700) at /home/kdab/src/kde/calligra/libs/textlayout/KoTextDocumentLayout.cpp:493 #46 0xb5025af5 in KoTextDocumentLayout::executeScheduledLayout (this=0x90b1700) at /home/kdab/src/kde/calligra/libs/textlayout/KoTextDocumentLayout.cpp:670 #47 0xb50261ab in KoTextDocumentLayout::qt_metacall (this=0x90b1700, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x8e9bf68) at /home/kdab/src/build/calligra/libs/textlayout/KoTextDocumentLayout.moc:89 #48 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #49 0xb56ba3a5 in QMetaCallEvent::placeMetaCall(QObject*) () from /usr/lib/libQtCore.so.4 #50 0xb56be5af in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4 #51 0xb5c9e414 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4 #52 0xb5ca70c7 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4 #53 0xb674e1f1 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5 #54 0xb56a8fde in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4 #55 0xb56acd6c in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4 #56 0xb56acebc in QCoreApplication::sendPostedEvents(QObject*, int) () from /usr/lib/libQtCore.so.4 #57 0xb56d75e4 in ?? () from /usr/lib/libQtCore.so.4 #58 0xb45b3509 in g_main_context_dispatch () from /lib/libglib-2.0.so.0 #59 0xb45b3d10 in ?? () from /lib/libglib-2.0.so.0 #60 0xb45b3fce in g_main_context_iteration () from /lib/libglib-2.0.so.0 #61 0xb56d776b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4 #62 0xb5d5455a in ?? () from /usr/lib/libQtGui.so.4 #63 0xb56ad153 in QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4 #64 0xb770ebd5 in KoProgressUpdater::update (this=0x833b828) at /home/kdab/src/kde/calligra/libs/main/KoProgressUpdater.cpp:163 #65 0xb770f1e1 in KoProgressUpdater::qt_metacall (this=0x833b828, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfde8c7c) at /home/kdab/src/build/calligra/libs/main/KoProgressUpdater.moc:73 #66 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #67 0xb56bfa2c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4 #68 0xb7710c15 in KoUpdaterPrivate::sigUpdated (this=0x8d57010) at /home/kdab/src/build/calligra/libs/main/KoUpdaterPrivate_p.moc:95 #69 0xb7710a85 in KoUpdaterPrivate::setProgress (this=0x8d57010, percent=100) at /home/kdab/src/kde/calligra/libs/main/KoUpdaterPrivate_p.cpp:45 #70 0xb7710bd0 in KoUpdaterPrivate::qt_metacall (this=0x8d57010, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0xbfde8dc8) at /home/kdab/src/build/calligra/libs/main/KoUpdaterPrivate_p.moc:84 #71 0xb56af8cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4 #72 0xb56bfa2c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4 #73 0xb7710648 in KoUpdater::sigProgress (this=0x82e76f0, _t1=100) at /home/kdab/src/build/calligra/libs/main/KoUpdater.moc:102 #74 0xb7710352 in KoUpdater::setProgress (this=0x82e76f0, percent=100) at /home/kdab/src/kde/calligra/libs/main/KoUpdater.cpp:61 #75 0xb76a1e94 in KoDocument::openFile (this=0x8207a60) at /home/kdab/src/kde/calligra/libs/main/KoDocument.cpp:1657 #76 0xb708c5c0 in ?? () from /usr/lib/libkparts.so.4 #77 0xb708cc89 in KParts::ReadOnlyPart::openUrl(KUrl const&) () from /usr/lib/libkparts.so.4 #78 0xb76a0190 in KoDocument::openUrl (this=0x8207a60, _url=...) at /home/kdab/src/kde/calligra/libs/main/KoDocument.cpp:1264 #79 0xb76c6cdb in KoMainWindow::openDocumentInternal (this=0x81e3d10, url=..., newdoc=0x8207a60) at /home/kdab/src/kde/calligra/libs/main/KoMainWindow.cpp:677 #80 0xb76c6b7a in KoMainWindow::openDocument (this=0x81e3d10, newdoc=0x8207a60, url=...) at /home/kdab/src/kde/calligra/libs/main/KoMainWindow.cpp:660 #81 0xb7695e94 in KoApplication::start (this=0xbfde94f0) at /home/kdab/src/kde/calligra/libs/main/KoApplication.cpp:252 #82 0xb778877a in kdemain (argc=2, argv=0xbfde95f4) at /home/kdab/src/kde/calligra/words/part/main.cpp:41 #83 0x080487d9 in main (argc=2, argv=0xbfde95f4) at /home/kdab/src/build/calligra/words/part/words_dummy.cpp:3 Seems that crash shows a big design-error in Calligra's KDE-UI architecture. In fact the KoDocument is responsible for managing the KoMainWindow's (means the model controls the view). That's why we cannot easily use a parent-child relationship like with following patch but need to proper sync KoDocument's manually if KoMainWindow's go out of scope :-/ While we are on it. It's even that ugly that KoApplication doesn't delete the initial KoDocument. Probably that's the reason for those "** (process:28215): WARNING **: 1 dictionaries weren't free'd." printed on quit of any calligra application. Yay :-/ diff --git a/libs/main/KoApplication.cpp b/libs/main/KoApplication.cpp index f97ae04..e7867f7 100644 --- a/libs/main/KoApplication.cpp +++ b/libs/main/KoApplication.cpp @@ -189,6 +189,7 @@ bool KoApplication::start() if (doc) { // show a shell asap KoMainWindow *shell = new KoMainWindow(doc->componentData()); + doc->setParent(shell); if (showShell || !benchmarkLoading) { shell->show(); } On Tuesday 07 June 2011 Jun, Sebastian Sauer wrote: > https://bugs.kde.org/show_bug.cgi?id=275065 > --- Comment #2 from Sebastian Sauer <mail dipe org> 2011-06-07 22:39:45 --- > Seems that crash shows a big design-error in Calligra's KDE-UI architecture. In > fact the KoDocument is responsible for managing the KoMainWindow's (means the > model controls the view). That's why we cannot easily use a parent-child > relationship like with following patch but need to proper sync KoDocument's > manually if KoMainWindow's go out of scope :-/ > > While we are on it. It's even that ugly that KoApplication doesn't delete the > initial KoDocument. Probably that's the reason for those "** (process:28215): > WARNING **: 1 dictionaries weren't free'd." printed on quit of any calligra > application. > > Yay :-/ > Yes... It's a big design error, and I've already spent quite a bit of time trying to disentangle it. But it's gotten very, very complicated because every application seems to use it in a slightly different, wrong way. Nice consequence of this design is also that splitting the view creates duplicates of all actions... KoMainWindow, KoDocument and KoView are just very, very wrong at the moment. Following patch would fix it the dirty way but then we still need to abort all current actions done in the KoDocument (e.g. layouting, loading, etc) and destroy the KoDocument as well else the KoDocument keeps on to run in the background forever. diff --git a/libs/main/KoDocument.cpp b/libs/main/KoDocument.cpp index e4aafa9..23e9fa2 100644 --- a/libs/main/KoDocument.cpp +++ b/libs/main/KoDocument.cpp @@ -2346,13 +2346,18 @@ void KoDocument::addShell(KoMainWindow *shell) //kDebug(30003) <<"shell" << (void*)shell <<"added to doc" << this; d->shells.append(shell); connect(shell, SIGNAL(documentSaved()), d->undoStack, SLOT(setClean())); + connect(shell, SIGNAL(destroyed(QObject*)), this, SLOT(shellDestroyed(QObject*))); } } void KoDocument::removeShell(KoMainWindow *shell) { //kDebug(30003) <<"shell" << (void*)shell <<"removed from doc" << this; - d->shells.removeAll(shell); + if (shell) { + disconnect(shell, SIGNAL(documentSaved()), d->undoStack, SLOT(setClean())); + disconnect(shell, SIGNAL(destroyed(QObject*)), this, SLOT(shellDestroyed(QObject*))); + d->shells.removeAll(shell); + } } const QList<KoMainWindow*>& KoDocument::shells() const @@ -2645,6 +2650,11 @@ void KoDocument::startCustomDocument() deleteOpenPane(); } +void KoDocument::shellDestroyed(QObject *obj) +{ + removeShell(static_cast<KoMainWindow*>(obj)); +} + KoOpenPane *KoDocument::createOpenPane(QWidget *parent, const KComponentData &componentData, const QString& templateType) { diff --git a/libs/main/KoDocument.h b/libs/main/KoDocument.h index 5be2b11..6c76bf9 100644 --- a/libs/main/KoDocument.h +++ b/libs/main/KoDocument.h @@ -1022,6 +1022,7 @@ private slots: void slotAutoSave(); void slotStarted(KIO::Job*); void startCustomDocument(); + void shellDestroyed(QObject *obj); private: i think more people need to voice an opinion, but given that this is a stop gap to a broken design, which we have stated our intention to redo at some point, i think we can live with hacks Just if someone is more into this area (i'm not), please look if this is the best hack we can do *** Bug 239452 has been marked as a duplicate of this bug. *** *** Bug 285553 has been marked as a duplicate of this bug. *** removing release_blocker flag as it may take forever to fix and only happens on close *** Bug 329128 has been marked as a duplicate of this bug. *** *** Bug 361303 has been marked as a duplicate of this bug. *** *** Bug 371589 has been marked as a duplicate of this bug. *** I'm no longer able to test any fixes to these bugs, if there would be a fix forthcoming. |