Bug 387564

Summary: Crash on closing Krita if a new window had been opened and closed previously
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: antti.savo
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alvin Wong 2017-12-03 19:04:15 UTC
Steps to reproduce:

1. Open file
2. Draw a few strokes
3. Window->New Window
4. Close the new window
5. Draw a few more strokes
6. Close Krita, discard changes

Might take more than a few tries...



krita.exe caused an Access Violation at location 000007FED6532E01 in module libkritaui.dll Reading from location FFFFFFFFFFFFFFFF.

AddrPC           Params
000007FED6532E01 000000000E8D19E0 000000000022AA10 00000000108E6670  libkritaui.dll!updateGUI  [F:/dev/krita/new/src/libs/ui/kis_action_manager.cpp @ 332]
   330:         }
   331: 
>  332:         action->setActionEnabled(enable);
   333:     }
   334: }
000007FED66A8E17 000007FED7171480 0000000000000000 0000063E0004000E  libkritaui.dll!subWindowActivated  [F:/dev/krita/new/src/libs/ui/KisMainWindow.cpp @ 1990]
  1988: 
  1989:     updateCaption();
> 1990:     d->actionManager()->updateGUI();
  1991: }
  1992: 
000007FED66B3D35 000000000E8D8120 0000000000000000 00000000FFFFFFFF  libkritaui.dll!qt_static_metacall  [F:/dev/krita/new/build_x64/build_krita/libs/ui/kritaui_autogen/include/moc_KisMainWindow.cpp @ 346]
   344:         case 51: _t->showErrorAndDie(); break;
   345:         case 52: _t->setActiveView((*reinterpret_cast< KisView*(*)>(_a[1]))); break;
>  346:         case 53: _t->subWindowActivated(); break;
   347:         case 54: _t->initializeGeometry(); break;
   348:         case 55: _t->showManual(); break;
000007FED6E7B2EA 000000000E8D8120 000007FED5FF6924 000000000022ABE0  Qt5Core.dll!activate  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qobject.cpp @ 3766]
  3764:                     qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv);
  3765: 
> 3766:                 callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv);
  3767: 
  3768:                 if (qt_signal_spy_callback_set.slot_end_callback != 0)
000007FED5FF2DE1 0000000000000080 0000000000000080 00000000004B0308  Qt5Widgets.dll!resetActiveWindow  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/b/qtbase/src/widgets/.moc/release/moc_qmdiarea.cpp @ 308]
   306: {
   307:     void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
>  308:     QMetaObject::activate(this, &staticMetaObject, 0, _a);
   309: }
   310: QT_WARNING_POP
000007FED5FF8998 0000000000000007 0000000000000040 000001B300250007  Qt5Widgets.dll!viewportEvent  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/widgets/qmdiarea.cpp @ 2432]
  2430:                 d->childWindows.removeAt(i);
  2431:                 d->indicesToActivatedChildren.removeAll(i);
> 2432:                 d->updateActiveWindow(i, activeRemoved);
  2433:                 d->arrangeMinimizedSubWindows();
  2434:                 break;
000007FED6E4F62C 0000000000000001 000007FEFD7313D2 0000000000000002  Qt5Core.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.cpp @ 1129]
  1127:                 continue;
  1128:             }
> 1129:             if (obj->eventFilter(receiver, event))
  1130:                 return true;
  1131:         }
000007FED5E97B55 00000000144EC6F0 000007FEFD7310C8 0000000000000080  Qt5Widgets.dll!notify_helper  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3718]
  3716: 
  3717:     // send to all receiver event filters
> 3718:     if (sendThroughObjectEventFilters(receiver, e))
  3719:         return true;
  3720: 
000007FED5E9EDF0 0000000000000004 000007FED6C70DEF 00000000140C8C40  Qt5Widgets.dll!notify  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3481]
  3479:                 }
  3480:             }
> 3481:             res = d->notify_helper(w, e);
  3482:             if (e->type() != QEvent::DragMove
  3483: #if QT_CONFIG(graphicsview)
000007FED667D0F6 0000000013D09B10 00000000140C8C40 000000020000000A  libkritaui.dll!notify  [F:/dev/krita/new/src/libs/ui/KisApplication.cpp @ 599]
   597: {
   598:     try {
>  599:         return QApplication::notify(receiver, event);
   600:     } catch (std::exception &e) {
   601:         qWarning("Error %s sending event %i to object %s",
000007FED6E50668 000000000022B0C0 000000000939A1C8 0000000000000030  Qt5Core.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.cpp @ 1018]
  1016:     if (!selfRequired)
  1017:         return doNotify(receiver, event);
> 1018:     return self->notify(receiver, event);
  1019: }
  1020: 
000007FED60027DF 97CF000000000410 000000000E8D8120 0000000000000000  Qt5Widgets.dll!closeEvent  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.h @ 233]
   231: #ifndef QT_NO_QOBJECT
   232: inline bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event)
>  233: {  if (event) event->spont = false; return notifyInternal2(receiver, event); }
   234: 
   235: inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
000007FED5ED4358 000000001471D300 00000000140C8C40 0000000000000002  Qt5Widgets.dll!event  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qwidget.cpp @ 9200]
  9198:     case QEvent::ActionRemoved:
  9199:     case QEvent::ActionChanged:
> 9200:         actionEvent((QActionEvent*)event);
  9201:         break;
  9202: #endif
000007FED6001F82 000000000022FB90 0000000000000000 000000000022FB90  Qt5Widgets.dll!event  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/widgets/qmdisubwindow.cpp @ 2933]
  2931:         break;
  2932:     }
> 2933:     return QWidget::event(event);
  2934: }
  2935: 
000007FED5E97B7C 000000000E9436A0 0000000076EADD48 000000000022B5E0  Qt5Widgets.dll!notify_helper  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3722]
  3720: 
  3721:     // deliver the event
> 3722:     bool consumed = receiver->event(e);
  3723:     QCoreApplicationPrivate::setEventSpontaneous(e, false);
  3724:     return consumed;
000007FED5E9EDF0 000000000022B730 000007FED6C70DEF 000007FE00000008  Qt5Widgets.dll!notify  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3481]
  3479:                 }
  3480:             }
> 3481:             res = d->notify_helper(w, e);
  3482:             if (e->type() != QEvent::DragMove
  3483: #if QT_CONFIG(graphicsview)
000007FED667D0F6 000007FEFABEF0EA 000007FEFD740891 000007FEFABEF0EA  libkritaui.dll!notify  [F:/dev/krita/new/src/libs/ui/KisApplication.cpp @ 599]
   597: {
   598:     try {
>  599:         return QApplication::notify(receiver, event);
   600:     } catch (std::exception &e) {
   601:         qWarning("Error %s sending event %i to object %s",
000007FED6E50668 00000000004EA770 0000000000000030 0000000076F703C8  Qt5Core.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.cpp @ 1018]
  1016:     if (!selfRequired)
  1017:         return doNotify(receiver, event);
> 1018:     return self->notify(receiver, event);
  1019: }
  1020: 
000007FED5ECF45F 000000000939A160 00006477F1A60716 00000000144EC8C8  Qt5Widgets.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.h @ 233]
   231: #ifndef QT_NO_QOBJECT
   232: inline bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event)
>  233: {  if (event) event->spont = false; return notifyInternal2(receiver, event); }
   234: 
   235: inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
000007FED5FF2406 0000000000000008 000007FE000003B6 000000000022B898  Qt5Widgets.dll!closeAllSubWindows  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/widgets/qmdiarea.cpp @ 1905]
  1903:         if (!sanityCheck(child, "QMdiArea::closeAllSubWindows"))
  1904:             continue;
> 1905:         child->close();
  1906:     }
  1907: 
000007FED66A9FF1 0000000000000000 000000000022BCF0 0000000000000020  libkritaui.dll!closeEvent  [F:/dev/krita/new/src/libs/ui/KisMainWindow.cpp @ 1195]
  1193: void KisMainWindow::closeEvent(QCloseEvent *e)
  1194: {
> 1195:     d->mdiArea->closeAllSubWindows();
  1196: 
  1197:     QAction *action= d->viewManager->actionCollection()->action("view_show_canvas_only");
000007FED5ED4358 00000000109725B0 000000001062B270 000000000022BCF0  Qt5Widgets.dll!event  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qwidget.cpp @ 9200]
  9198:     case QEvent::ActionRemoved:
  9199:     case QEvent::ActionChanged:
> 9200:         actionEvent((QActionEvent*)event);
  9201:         break;
  9202: #endif
000007FED5FE65ED 0000000000000007 0000000000000018 000000BE00080007  Qt5Widgets.dll!event  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/widgets/qmainwindow.cpp @ 1563]
  1561:     }
  1562: 
> 1563:     return QWidget::event(event);
  1564: }
  1565: 
000007FEDB304E4C 000000000022FB90 0000000000000000 000000000022FB90  libkritawidgetutils.dll!event  [F:/dev/krita/new/src/libs/widgetutils/xmlgui/kmainwindow.cpp @ 780]
   778:         break;
   779:     }
>  780:     return QMainWindow::event(ev);
   781: }
   782: 
000007FED5E97B7C 000000000E9436A0 000007FED71C2000 000000000022BCF0  Qt5Widgets.dll!notify_helper  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3722]
  3720: 
  3721:     // deliver the event
> 3722:     bool consumed = receiver->event(e);
  3723:     QCoreApplicationPrivate::setEventSpontaneous(e, false);
  3724:     return consumed;
000007FED5E9EDF0 000000000C0BAD40 000007FED6C70DEF 000000003DFB5C10  Qt5Widgets.dll!notify  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3481]
  3479:                 }
  3480:             }
> 3481:             res = d->notify_helper(w, e);
  3482:             if (e->type() != QEvent::DragMove
  3483: #if QT_CONFIG(graphicsview)
000007FED667D0F6 0000000014564DE0 000000000050A2E0 0000000000000009  libkritaui.dll!notify  [F:/dev/krita/new/src/libs/ui/KisApplication.cpp @ 599]
   597: {
   598:     try {
>  599:         return QApplication::notify(receiver, event);
   600:     } catch (std::exception &e) {
   601:         qWarning("Error %s sending event %i to object %s",
000007FED6E50668 000000000E8D8120 000007FED5FF8E43 00000000102EC7B8  Qt5Core.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.cpp @ 1018]
  1016:     if (!selfRequired)
  1017:         return doNotify(receiver, event);
> 1018:     return self->notify(receiver, event);
  1019: }
  1020: 
000007FED5ECF691 000000000FBFAEB0 000000000022C1A0 000007FED70694C8  Qt5Widgets.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.h @ 236]
   234: 
   235: inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
>  236: { if (event) event->spont = true; return notifyInternal2(receiver, event); }
   237: #endif
   238: 
000007FED5EE84FA 00000000023DF2A0 000007FED6E4F51C 0000000000000001  Qt5Widgets.dll!handleCloseEvent  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qwidgetwindow.cpp @ 777]
   775: void QWidgetWindow::handleCloseEvent(QCloseEvent *event)
   776: {
>  777:     bool is_closing = m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
   778:     event->setAccepted(is_closing);
   779: }
000007FED5EEB4E1 000000000022FB90 00000000024736D0 0000000000000001  Qt5Widgets.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qwidgetwindow.cpp @ 202]
   200:     switch (event->type()) {
   201:     case QEvent::Close:
>  202:         handleCloseEvent(static_cast<QCloseEvent *>(event));
   203:         return true;
   204: 
000007FED5E97B7C 0000000000000001 000007FED6EA3609 0000000002474F10  Qt5Widgets.dll!notify_helper  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3722]
  3720: 
  3721:     // deliver the event
> 3722:     bool consumed = receiver->event(e);
  3723:     QCoreApplicationPrivate::setEventSpontaneous(e, false);
  3724:     return consumed;
000007FED5E9EDF0 0000000000000014 000007FED6C70DEF 0000000000060001  Qt5Widgets.dll!notify  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/widgets/kernel/qapplication.cpp @ 3481]
  3479:                 }
  3480:             }
> 3481:             res = d->notify_helper(w, e);
  3482:             if (e->type() != QEvent::DragMove
  3483: #if QT_CONFIG(graphicsview)
000007FED667D0F6 000000000000FF00 0000000000030000 0000000000000401  libkritaui.dll!notify  [F:/dev/krita/new/src/libs/ui/KisApplication.cpp @ 599]
   597: {
   598:     try {
>  599:         return QApplication::notify(receiver, event);
   600:     } catch (std::exception &e) {
   601:         qWarning("Error %s sending event %i to object %s",
000007FED6E50668 0000000000000000 0000000000000000 0000000000000000  Qt5Core.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.cpp @ 1018]
  1016:     if (!selfRequired)
  1017:         return doNotify(receiver, event);
> 1018:     return self->notify(receiver, event);
  1019: }
  1020: 
000007FED95B665D 00000000023BEC11 00000000023BEBF8 0000000013FD9EC8  Qt5Gui.dll! ??   [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.h @ 236]
   234: 
   235: inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
>  236: { if (event) event->spont = true; return notifyInternal2(receiver, event); }
   237: #endif
   238: 
000007FED95BAD95 000000000050A2E0 0000000002474F10 00000000002006FA  Qt5Gui.dll!processWindowSystemEvent  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/gui/kernel/qguiapplication.cpp @ 1771]
  1769:         break;
  1770:     case QWindowSystemInterfacePrivate::Close:
> 1771:         QGuiApplicationPrivate::processCloseEvent(
  1772:                 static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
  1773:         break;
000007FED9591CB0 0000000000000000 000007FEEB0596DF 000000000000FF00  Qt5Gui.dll!sendWindowSystemEvents  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/gui/kernel/qwindowsysteminterface.cpp @ 939]
   937:         } else {
   938:             nevents++;
>  939:             QGuiApplicationPrivate::processWindowSystemEvent(event);
   940:         }
   941: 
000007FED6EA7ED6 0000000000000000 0000000000000038 000000000022C4A8  Qt5Core.dll!qt_internal_proc  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qeventdispatcher_win.cpp @ 235]
   233:         if (localSerialNumber != d->lastSerialNumber) {
   234:             d->lastSerialNumber = localSerialNumber;
>  235:             q->sendPostedEvents();
   236:         }
   237:         return 0;
0000000076D79BBD 000000000022C5D0 000007FED6EA79A0 0000000000000000  USER32.dll!UserCallWinProcCheckWow
0000000076D798C2 000000000050A2E0 000000000050A2E0 000007FED6EA79A0  USER32.dll!DispatchMessageWorker
000007FED6EA71CB 0000000002474F10 0000000000000024 00000000023DF4D0  Qt5Core.dll!processEvents  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qeventdispatcher_win.cpp @ 627]
   625:                 if (!filterNativeEvent(QByteArrayLiteral("windows_generic_MSG"), &msg, 0)) {
   626:                     TranslateMessage(&msg);
>  627:                     DispatchMessage(&msg);
   628:                 }
   629:             } else if (waitRet - WAIT_OBJECT_0 < nCount) {
000000006A8DEF65 0000000000000080 0000000000000014 0000000013DABA20  qwindows.dll!processEvents  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp @ 74]
    72:     const QEventLoop::ProcessEventsFlags oldFlags = m_flags;
    73:     m_flags = flags;
>   74:     const bool rc = QEventDispatcherWin32::processEvents(flags);
    75:     m_flags = oldFlags;
    76:     return rc;
000007FED6E4ED4F 0000000000000000 000007FED6CB1C70 000007FED6FA8100  Qt5Core.dll!exec  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qeventloop.cpp @ 134]
   132:     if (!d->threadData->eventDispatcher.load())
   133:         return false;
>  134:     return d->threadData->eventDispatcher.load()->processEvents(flags);
   135: }
   136: 
000007FED6E576A7 000000000022FC00 000000000022FB90 000000000022FB80  Qt5Core.dll!exec  [F:/dev/krita/new/build_x64/build_3rdparty/ext_qt/s/qtbase/src/corelib/kernel/qcoreapplication.cpp @ 1291]
  1289:     self->d_func()->in_exec = true;
  1290:     self->d_func()->aboutToQuitEmitted = false;
> 1291:     int returnCode = eventLoop.exec();
  1292:     threadData->quitNow = false;
  1293: 
0000000140005F13 0000000000000001 00000000024736B0 000000014048B988  krita.exe!main  [F:/dev/krita/new/src/krita/main.cc @ 306]
   304:                      &app, SLOT(fileOpenRequested(QString)));
   305: 
>  306:     int state = app.exec();
   307: 
   308:     {
00000001400013F8 0000000000000000 0000000000000000 0000000000000000  krita.exe!0x1000013f8
00000001400014EB 0000000000000000 0000000000000000 0000000000000000  krita.exe!0x1000014eb
0000000076C559CD 0000000000000000 0000000000000000 0000000000000000  kernel32.dll!BaseThreadInitThunk
0000000076E8A561 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart
Comment 1 Antti Savolainen 2018-06-26 17:38:34 UTC
Boudewijn has investigated and fixed this at some point. Reopen this report if this is untrue.