Bug 359217 - Krita crashes after closing an extra view of a file with painting assistants
Summary: Krita crashes after closing an extra view of a file with painting assistants
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: OpenGL Canvas (show other bugs)
Version: 2.9.11
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-10 08:05 UTC by Alvin Wong
Modified: 2016-05-05 08:02 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Test file for convenience (140.10 KB, application/x-krita)
2016-02-10 08:07 UTC, Alvin Wong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Wong 2016-02-10 08:05:50 UTC
When multiple views of a file with painting assistants are opened, closing one of them and switching to another causes Krita to close without prompting user to save the file. Doesn't matter whether the view is in the same window or not.

Reproducible: Always

Steps to Reproduce:
1. Create file and add a painting assistant (e.g. Vanishing Point.)
2. *Save the file and close it, then reopen the file.* (Without reopening the file, the painting assistants won't appear in the new view, unrelated usability bug?)
3. (Optional:) Make changes without saving.
4. Open a new view. (Window -> New View -> select file)
5. Close the new view.
6. (Only when tabbed and when another document is opened:) Switch to another view of the same file.


Actual Results:  
Krita force-closed (or crashed without any feedback).

Expected Results:  
Nothing special.
Comment 1 Alvin Wong 2016-02-10 08:07:37 UTC
Created attachment 97129 [details]
Test file for convenience
Comment 2 Halla Rempt 2016-03-22 16:25:15 UTC
Hi Alvin,

I can reproduce the issue:

Application: krita (krita), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f25f4c5b7c0 (LWP 13171))]

Thread 7 (Thread 0x7f25c2199700 (LWP 13173)):
#0  0x00007f25e92a303f in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007f25ed36d34b in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib64/libQt5Core.so.5
#2  0x00007f25ed36653b in QSemaphore::acquire(int) () at /usr/lib64/libQt5Core.so.5
#3  0x00007f25f375bc52 in KisTileDataPooler::run() (this=0x7f25f3c08540 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder>) at /home/boud/dev/krita/libs/image/tiles3/kis_tile_data_pooler.cc:165
#4  0x00007f25f375bc52 in KisTileDataPooler::run() (this=0x7f25f3c08540 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder>) at /home/boud/dev/krita/libs/image/tiles3/kis_tile_data_pooler.cc:187
#5  0x00007f25ed36c32f in  () at /usr/lib64/libQt5Core.so.5
#6  0x00007f25e794b754 in  () at /usr/X11R6/lib64/libGL.so.1
#7  0x00007f25e929f0a4 in start_thread () at /lib64/libpthread.so.0
#8  0x00007f25ec763fed in clone () at /lib64/libc.so.6

Thread 6 (Thread 0x7f25c1998700 (LWP 13174)):
#0  0x00007f25e92a303f in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007f25ed36d34b in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib64/libQt5Core.so.5
#2  0x00007f25ed3667c6 in QSemaphore::tryAcquire(int, int) () at /usr/lib64/libQt5Core.so.5
#3  0x00007f25f3779f23 in KisTileDataSwapper::waitForWork() (this=<optimized out>) at /home/boud/dev/krita/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#4  0x00007f25f377a10a in KisTileDataSwapper::run() (this=0x7f25f3c08580 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder+64>) at /home/boud/dev/krita/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#5  0x00007f25ed36c32f in  () at /usr/lib64/libQt5Core.so.5
#6  0x00007f25e794b754 in  () at /usr/X11R6/lib64/libGL.so.1
#7  0x00007f25e929f0a4 in start_thread () at /lib64/libpthread.so.0
#8  0x00007f25ec763fed in clone () at /lib64/libc.so.6

Thread 5 (Thread 0x7f25b8ff9700 (LWP 13182)):
#0  0x00007f25e92a33e8 in pthread_cond_timedwait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007f25ed36d298 in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib64/libQt5Core.so.5
#2  0x00007f25ed3694e6 in  () at /usr/lib64/libQt5Core.so.5
#3  0x00007f25ed36c32f in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007f25e794b754 in  () at /usr/X11R6/lib64/libGL.so.1
#5  0x00007f25e929f0a4 in start_thread () at /lib64/libpthread.so.0
#6  0x00007f25ec763fed in clone () at /lib64/libc.so.6

Thread 4 (Thread 0x7f2597fff700 (LWP 13184)):
#0  0x00007f25e92a303f in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007f25ed36d34b in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib64/libQt5Core.so.5
#2  0x00007f25ee45116d in  () at /usr/lib64/libQt5Widgets.so.5
#3  0x00007f25ed36c32f in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007f25e794b754 in  () at /usr/X11R6/lib64/libGL.so.1
#5  0x00007f25e929f0a4 in start_thread () at /lib64/libpthread.so.0
#6  0x00007f25ec763fed in clone () at /lib64/libc.so.6

Thread 3 (Thread 0x7f25bb7fe700 (LWP 13242)):
#0  0x00007f25e92a33e8 in pthread_cond_timedwait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007f25ed36d298 in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib64/libQt5Core.so.5
#2  0x00007f25ed3694e6 in  () at /usr/lib64/libQt5Core.so.5
#3  0x00007f25ed36c32f in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007f25e794b754 in  () at /usr/X11R6/lib64/libGL.so.1
#5  0x00007f25e929f0a4 in start_thread () at /lib64/libpthread.so.0
#6  0x00007f25ec763fed in clone () at /lib64/libc.so.6

Thread 2 (Thread 0x7f25b97fa700 (LWP 13244)):
#0  0x00007f25e92a33e8 in pthread_cond_timedwait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007f25ed36d298 in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib64/libQt5Core.so.5
#2  0x00007f25ed3694e6 in  () at /usr/lib64/libQt5Core.so.5
#3  0x00007f25ed36c32f in  () at /usr/lib64/libQt5Core.so.5
#4  0x00007f25e794b754 in  () at /usr/X11R6/lib64/libGL.so.1
#5  0x00007f25e929f0a4 in start_thread () at /lib64/libpthread.so.0
#6  0x00007f25ec763fed in clone () at /lib64/libc.so.6

Thread 1 (Thread 0x7f25f4c5b7c0 (LWP 13171)):
[KCrash Handler]
#4  0x0000000000000040 in  ()
#5  0x00007f25f44889e4 in KisTextureTile::bindToActiveTexture() (texture=<optimized out>, target=3553, this=<optimized out>) at /usr/include/qt5/QtGui/qopenglfunctions.h:573
#6  0x00007f25f44889e4 in KisTextureTile::bindToActiveTexture() (this=this@entry=0x187fc130) at /home/boud/dev/krita/libs/ui/opengl/kis_texture_tile.cpp:122
#7  0x00007f25f447bf6b in KisOpenGLCanvas2::drawImage() (this=this@entry=0xa577ca0) at /home/boud/dev/krita/libs/ui/opengl/kis_opengl_canvas2.cpp:561
#8  0x00007f25f447c493 in KisOpenGLCanvas2::renderCanvasGL() (this=this@entry=0xa577ca0) at /home/boud/dev/krita/libs/ui/opengl/kis_opengl_canvas2.cpp:749
#9  0x00007f25f447c553 in KisOpenGLCanvas2::paintGL() (this=0xa577ca0) at /home/boud/dev/krita/libs/ui/opengl/kis_opengl_canvas2.cpp:273
#10 0x00007f25ee28934b in QOpenGLWidget::resizeEvent(QResizeEvent*) () at /usr/lib64/libQt5Widgets.so.5
#11 0x00007f25ee26c4e3 in QWidget::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#12 0x00007f25ee22be7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#13 0x00007f25ee230cc8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#14 0x00007f25f4593ce0 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0xa577ca0, event=0x7fff78d91900) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:514
#15 0x00007f25ed547e95 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#16 0x00007f25ee265361 in QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) () at /usr/lib64/libQt5Widgets.so.5
#17 0x00007f25ee268cc3 in QWidgetPrivate::show_helper() () at /usr/lib64/libQt5Widgets.so.5
#18 0x00007f25ee268c5a in QWidgetPrivate::showChildren(bool) () at /usr/lib64/libQt5Widgets.so.5
#19 0x00007f25ee268cdf in QWidgetPrivate::show_helper() () at /usr/lib64/libQt5Widgets.so.5
#20 0x00007f25ee268c5a in QWidgetPrivate::showChildren(bool) () at /usr/lib64/libQt5Widgets.so.5
#21 0x00007f25ee268cdf in QWidgetPrivate::show_helper() () at /usr/lib64/libQt5Widgets.so.5
#22 0x00007f25ee268c5a in QWidgetPrivate::showChildren(bool) () at /usr/lib64/libQt5Widgets.so.5
#23 0x00007f25ee268cdf in QWidgetPrivate::show_helper() () at /usr/lib64/libQt5Widgets.so.5
#24 0x00007f25ee268c5a in QWidgetPrivate::showChildren(bool) () at /usr/lib64/libQt5Widgets.so.5
#25 0x00007f25ee268cdf in QWidgetPrivate::show_helper() () at /usr/lib64/libQt5Widgets.so.5
#26 0x00007f25ee26b807 in QWidget::setVisible(bool) () at /usr/lib64/libQt5Widgets.so.5
#27 0x00007f25ee39806d in  () at /usr/lib64/libQt5Widgets.so.5
#28 0x00007f25ee398b92 in QMdiSubWindow::changeEvent(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#29 0x00007f25ee26bcdf in QWidget::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#30 0x00007f25ee3995db in QMdiSubWindow::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#31 0x00007f25ee22be7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#32 0x00007f25ee230cc8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#33 0x00007f25f4593ce0 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0xa56f760, event=0x7fff78d921e0) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:514
#34 0x00007f25ed547e95 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#35 0x00007f25ee26838a in QWidget::setWindowState(QFlags<Qt::WindowState>) () at /usr/lib64/libQt5Widgets.so.5
#36 0x00007f25ee268a51 in QWidget::showMaximized() () at /usr/lib64/libQt5Widgets.so.5
#37 0x00007f25ee38b075 in  () at /usr/lib64/libQt5Widgets.so.5
#38 0x00007f25ee38b0dc in  () at /usr/lib64/libQt5Widgets.so.5
#39 0x00007f25ee38b38d in  () at /usr/lib64/libQt5Widgets.so.5
#40 0x00007f25ed577cc6 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5
#41 0x00007f25ee38f1e6 in QMdiSubWindow::windowStateChanged(QFlags<Qt::WindowState>, QFlags<Qt::WindowState>) () at /usr/lib64/libQt5Widgets.so.5
#42 0x00007f25ee398559 in  () at /usr/lib64/libQt5Widgets.so.5
#43 0x00007f25ee38b3a7 in  () at /usr/lib64/libQt5Widgets.so.5
#44 0x00007f25ed577cc6 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5
#45 0x00007f25ee3c0b0e in QTabBar::currentChanged(int) () at /usr/lib64/libQt5Widgets.so.5
#46 0x00007f25ee3c6218 in QTabBar::setCurrentIndex(int) () at /usr/lib64/libQt5Widgets.so.5
#47 0x00007f25ee3c86be in QTabBar::mousePressEvent(QMouseEvent*) () at /usr/lib64/libQt5Widgets.so.5
#48 0x00007f25ee38c8f7 in  () at /usr/lib64/libQt5Widgets.so.5
#49 0x00007f25ee26c3ba in QWidget::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#50 0x00007f25ee3cbf93 in QTabBar::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#51 0x00007f25ee22be7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#52 0x00007f25ee2312cb in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#53 0x00007f25f4593ce0 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0xa2b2f20, event=0x7fff78d92d90) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:514
#54 0x00007f25ed547e95 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#55 0x00007f25ee230191 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib64/libQt5Widgets.so.5
#56 0x00007f25ee28513b in  () at /usr/lib64/libQt5Widgets.so.5
#57 0x00007f25ee287353 in  () at /usr/lib64/libQt5Widgets.so.5
#58 0x00007f25ee22be7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#59 0x00007f25ee230cc8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#60 0x00007f25f4593ce0 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0xa21fb70, event=0x7fff78d93280) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:514
#61 0x00007f25ed547e95 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#62 0x00007f25eda99964 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib64/libQt5Gui.so.5
#63 0x00007f25eda9b175 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib64/libQt5Gui.so.5
#64 0x00007f25eda80268 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Gui.so.5
#65 0x00007f25e0f72200 in  () at /usr/lib64/libQt5XcbQpa.so.5
#66 0x00007f25e7e69c84 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#67 0x00007f25e7e69ed8 in  () at /usr/lib64/libglib-2.0.so.0
#68 0x00007f25e7e69f7c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#69 0x00007f25ed59ed6c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#70 0x00007f25ed545d53 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#71 0x00007f25ed54d8f6 in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#72 0x00000000004033a8 in main(int, char**) (argc=2, argv=0x7fff78d93968) at /home/boud/dev/krita/krita/main.cc:178
Comment 3 Stefano Bonicatti 2016-04-05 08:30:06 UTC
I can confirm this too in Krita 3.0 4256943a1e17b52f61a5489b2f1a781379a2ed80.

We also have a general issue with OpenGL and new views opened on the same image.
First of all we destroy and recreate the opengl image texture too many times (once should be enough? but it happens like 3-4 times, due to separate events like connecting the canvas and setting the monitor profile).
Then when closing the new view it crashes inside KisTextureTile::bindToActiveTexture with an access violation (the chain of calls comes from drawGL) most likely because that tile is actually being deleted and the canvas for some reason refers to an old opengl texture.
Comment 4 Dmitry Kazakov 2016-05-03 12:14:56 UTC
https://phabricator.kde.org/T2411
Comment 5 Dmitry Kazakov 2016-05-05 08:02:30 UTC
Git commit a1e6bb022bd0803a9e616dc77a62e83017104374 by Dmitry Kazakov.
Committed on 05/05/2016 at 07:50.
Pushed by dkazakov into branch 'master'.

Fix assistants be stored in KisDocument not in view decorations

Well, they should be stored in "model", not in the "view"
Fixes T2411

M  +9    -0    libs/global/kis_global.h
M  +4    -0    libs/image/kis_types.h
M  +5    -12   libs/ui/KisDocument.cpp
M  +2    -10   libs/ui/KisDocument.h
M  +1    -5    libs/ui/KisView.cpp
M  +47   -31   libs/ui/kis_painting_assistants_decoration.cpp
M  +3    -3    libs/ui/kis_painting_assistants_decoration.h
M  +3    -3    libs/ui/kra/kis_kra_loader.cpp
M  +1    -1    libs/ui/kra/kis_kra_loader.h
M  +4    -4    libs/ui/kra/kis_kra_saver.cpp
M  +32   -31   plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.cc
M  +8    -8    plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h

http://commits.kde.org/krita/a1e6bb022bd0803a9e616dc77a62e83017104374