Bug 261940

Summary: Krita 2.3 final crashes on startup
Product: [Applications] krita Reporter: Mario Locati <mario>
Component: GeneralAssignee: Halla Rempt <halla>
Status: RESOLVED FIXED    
Severity: crash CC: halla, takpeh
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Mario Locati 2011-01-03 11:18:56 UTC
Application: krita (2.3.0)
KDE Platform Version: 4.5.4 (KDE 4.5.4)
Qt Version: 4.7.0
Operating System: Linux 2.6.35-24-generic x86_64
Distribution: Ubuntu 10.10

-- Information about the crash:
Just started up my Kubuntu 10.10 installation on my DELL XPS 15 laptop and the final version of Krita 2.3 simply don't start. Installed over a pre-existing installation of KOffice 2.2 final.

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f3dc84127a0 (LWP 3088))]

Thread 3 (Thread 0x7f3da2d76700 (LWP 3089)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f3dc6371e3b in wait (this=<value optimized out>, mutex=0x539ba50, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:88
#2  QWaitCondition::wait (this=<value optimized out>, mutex=0x539ba50, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:160
#3  0x00007f3dc636db0b in QSemaphore::acquire (this=0x539b690, n=1) at thread/qsemaphore.cpp:144
#4  0x00007f3db1b3f35e in KisTileDataPooler::waitForWork (this=0x539b680) at ../../../krita/image/tiles3/kis_tile_data_pooler.cc:127
#5  0x00007f3db1b3f5a8 in KisTileDataPooler::run (this=0x539b680) at ../../../krita/image/tiles3/kis_tile_data_pooler.cc:156
#6  0x00007f3dc637127e in QThreadPrivate::start (arg=0x539b680) at thread/qthread_unix.cpp:266
#7  0x00007f3dbb7dd953 in ?? () from /usr/lib/nvidia-current/libGL.so.1
#8  0x00007f3dc2c12971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#9  0x00007f3dc7d9c92d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f3da2575700 (LWP 3090)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f3dc6371e3b in wait (this=<value optimized out>, mutex=0x53a2360, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:88
#2  QWaitCondition::wait (this=<value optimized out>, mutex=0x53a2360, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:160
#3  0x00007f3dc636ddab in QSemaphore::tryAcquire (this=0x53a2320, n=1, timeout=<value optimized out>) at thread/qsemaphore.cpp:221
#4  0x00007f3db1b5c2ea in KisTileDataSwapper::run (this=0x539b6b0) at ../../../krita/image/tiles3/swap/kis_tile_data_swapper.cpp:90
#5  0x00007f3dc637127e in QThreadPrivate::start (arg=0x539b6b0) at thread/qthread_unix.cpp:266
#6  0x00007f3dbb7dd953 in ?? () from /usr/lib/nvidia-current/libGL.so.1
#7  0x00007f3dc2c12971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#8  0x00007f3dc7d9c92d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f3dc84127a0 (LWP 3088)):
[KCrash Handler]
#6  KisSharedPtr (this=0x539a3c0) at ../../../krita/image/kis_shared_ptr.h:102
#7  KisImage::globalSelection (this=0x539a3c0) at ../../../krita/image/kis_image.cc:223
#8  0x00007f3db1bddc37 in KisLayer::selection (this=0x53b05c0) at ../../../krita/image/kis_layer.cc:256
#9  0x00007f3db1f85b62 in KisCanvas2::shapeManager (this=0x5cbd0e0) at ../../../krita/ui/canvas/kis_canvas2.cpp:264
#10 0x00007f3db1fbb892 in KisNodeShape::editabilityChanged (this=<value optimized out>) at ../../../krita/ui/flake/kis_node_shape.cpp:152
#11 0x00007f3db1fbbc35 in KisNodeShape::KisNodeShape (this=0xaa13ec0, parent=0xa9f5800, node=...) at ../../../krita/ui/flake/kis_node_shape.cpp:56
#12 0x00007f3db1fbeff8 in KisShapeController::Private::addNodeShape (this=0x65754e0, node=) at ../../../krita/ui/flake/kis_shape_controller.cpp:106
#13 0x00007f3db1fbee98 in KisShapeController::Private::addNodeShape (this=0x65754e0, node=<value optimized out>) at ../../../krita/ui/flake/kis_shape_controller.cpp:114
#14 0x00007f3db1fbee98 in KisShapeController::Private::addNodeShape (this=0x65754e0, node=<value optimized out>) at ../../../krita/ui/flake/kis_shape_controller.cpp:114
#15 0x00007f3db1fbfa7d in KisShapeController::setImage (this=0x61edba0, image=) at ../../../krita/ui/flake/kis_shape_controller.cpp:178
#16 0x00007f3db200974f in KisDoc2::completeLoading (this=0x5292520, store=0x654c6e0) at ../../../krita/ui/kis_doc2.cc:327
#17 0x00007f3dc79cb607 in KoDocument::loadNativeFormatFromStoreInternal (this=0x5292520, store=0x654c6e0) at ../../../libs/main/KoDocument.cpp:1753
#18 0x00007f3dc79cc532 in KoDocument::loadNativeFormatFromStore (this=0x5292520, file=...) at ../../../libs/main/KoDocument.cpp:1637
#19 0x00007f3dc79cc791 in KoDocument::loadNativeFormat (this=0x5292520, file_=<value optimized out>) at ../../../libs/main/KoDocument.cpp:1617
#20 0x00007f3dc79c8bf7 in KoDocument::openFile (this=0x5292520) at ../../../libs/main/KoDocument.cpp:1409
#21 0x00007f3dc5dbe987 in KParts::ReadOnlyPart::openUrl (this=0x5292520, url=<value optimized out>) at ../../kparts/part.cpp:557
#22 0x00007f3dc79c6f3c in KoDocument::openUrl (this=0x5292520, _url=...) at ../../../libs/main/KoDocument.cpp:1251
#23 0x00007f3db200a3c4 in KisDoc2::showStartUpWidget (this=0x5292520, parent=<value optimized out>, alwaysShow=<value optimized out>) at ../../../krita/ui/kis_doc2.cc:464
#24 0x00007f3dc79b7400 in KoApplication::start (this=<value optimized out>) at ../../../libs/main/KoApplication.cpp:156
#25 0x00007f3dc803bf83 in kdemain (argc=<value optimized out>, argv=<value optimized out>) at ../../krita/main.cc:46
#26 0x00007f3dc7cd4d8e in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fff794f41f8) at libc-start.c:226
#27 0x0000000000400659 in _start ()

Possible duplicates by query: bug 261911, bug 252332.

Reported using DrKonqi
Comment 1 Halla Rempt 2011-01-03 11:30:55 UTC
I suspect an issue with the ubuntu packages then. Almost as if some parts of 2.2. remain installed after upgrading to 2.3.
Comment 2 Halla Rempt 2011-01-03 16:25:12 UTC
Okay, probably not... We're investigating.
Comment 3 Halla Rempt 2011-01-05 10:16:48 UTC
Okay, with the help of Sven Langkamp we figured out what causes the crash: if you have used Krita before 2.3 _and_ checked "always use this template" for a template, then you get a crash on startup. I'm investigating a fix. 

If you want to run krita, please add the following line to your .kde/share/config/kritarc

firstRun=false

or remove the kritarc file altogether.
Comment 4 Halla Rempt 2011-01-05 10:42:42 UTC
commit eb493aa2b562b0a384899b2327501ac058171aaf
branch master
Author: Boudewijn Rempt <boud@valdyas.org>
Date:   Wed Jan 5 10:36:19 2011 +0100

    check whether the image wsp is valid
    
    We should check whether a weak shared pointer is valid, instead
    of checking the pointer -- which isn't set to 0 after the corresponding
    shared pointer is deleted.
    
    Should be backported to 2.3.
    
    CCMAIL:kimageshop@kde.org
    
    BUG:261940

diff --git a/krita/image/kis_layer.cc b/krita/image/kis_layer.cc
index c28983c..f661142 100644
--- a/krita/image/kis_layer.cc
+++ b/krita/image/kis_layer.cc
@@ -140,7 +140,7 @@ KisLayer::~KisLayer()
 
 const KoColorSpace * KisLayer::colorSpace() const
 {
-    if (m_d->image)
+    if (m_d->image.isValid())
         return m_d->image->colorSpace();
     return 0;
 }
@@ -252,7 +252,7 @@ KisSelectionSP KisLayer::selection() const
 
     if (layer->selectionMask())
         return layer->selectionMask()->selection();
-    else if (m_d->image)
+    else if (m_d->image.isValid())
         return m_d->image->globalSelection();
     else
         return KisSelectionSP(new KisSelection());
diff --git a/krita/ui/canvas/kis_coordinates_converter.cpp b/krita/ui/canvas/kis_coordinates_converter.cpp
index c922b24..e7158f9 100644
--- a/krita/ui/canvas/kis_coordinates_converter.cpp
+++ b/krita/ui/canvas/kis_coordinates_converter.cpp
@@ -45,7 +45,7 @@ struct KisCoordinatesConverter::Private {
 
 void KisCoordinatesConverter::recalculateTransformations() const
 {
-    if(!m_d->image) return;
+    if(!m_d->image.isValid()) return;
 
     m_d->imageToDocument = QTransform::fromScale(1 / m_d->image->xRes(),
                                                  1 / m_d->image->yRes());
@@ -238,19 +238,19 @@ void KisCoordinatesConverter::getOpenGLCheckersInfo(QTransform *textureTransform
 
 QRectF KisCoordinatesConverter::imageRectInWidgetPixels() const
 {
-    if(!m_d->image) return QRectF();
+    if(!m_d->image.isValid()) return QRectF();
     return viewportToWidget(imageToViewport(m_d->image->bounds()));
 }
 
 QRectF KisCoordinatesConverter::imageRectInViewportPixels() const
 {
-    if(!m_d->image) return QRectF();
+    if(!m_d->image.isValid()) return QRectF();
     return imageToViewport(m_d->image->bounds());
 }
 
 QSizeF KisCoordinatesConverter::imageSizeInFlakePixels() const
 {
-    if(!m_d->image) return QSizeF();
+    if(!m_d->image.isValid()) return QSizeF();
 
     qreal scaleX, scaleY;
     imageScale(&scaleX, &scaleY);
diff --git a/krita/ui/flake/kis_shape_controller.cpp b/krita/ui/flake/kis_shape_controller.cpp
index 1ee800f..25f87f6 100644
--- a/krita/ui/flake/kis_shape_controller.cpp
+++ b/krita/ui/flake/kis_shape_controller.cpp
@@ -162,7 +162,7 @@ KisShapeController::~KisShapeController()
 
 void KisShapeController::setImage(KisImageWSP image)
 {
-    if (m_d->image) {
+    if (m_d->image.isValid()) {
         m_d->image->disconnect(this);
         m_d->removeNodeShape(m_d->rootNode);
Comment 5 Halla Rempt 2011-01-05 13:21:59 UTC
SVN commit 1211995 by rempt:

Do not crash when loading the tutorial if always start with template is checked

CCBUG:261911
CCBUG:261940


 M  +2 -2      image/kis_layer.cc  
 M  +5 -0      image/kis_node.cpp  
 M  +4 -4      ui/canvas/kis_coordinates_converter.cpp  
 M  +1 -1      ui/flake/kis_shape_controller.cpp  
 M  +6 -0      ui/kis_doc2.cc  
 M  +0 -1      ui/kis_node_model.cpp  
 M  +1 -1      ui/kis_view2.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1211995
Comment 6 Christoph Feck 2011-01-05 20:09:34 UTC
*** Bug 262205 has been marked as a duplicate of this bug. ***