Bug 293704 - calligra words crashes, when inserting a spreadsheet shape
Summary: calligra words crashes, when inserting a spreadsheet shape
Status: RESOLVED FIXED
Alias: None
Product: calligrasheets
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Calligra Sheets (KSpread) Bugs
URL:
Keywords:
: 296690 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-09 11:14 UTC by Franz Trischberger
Modified: 2012-03-29 14:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Franz Trischberger 2012-02-09 11:14:15 UTC
Application: calligrawords (2.4 Beta 7)
KDE Platform Version: 4.8.00 (4.8.0 (Compiled from sources)
Qt Version: 4.8.0
Operating System: Linux 3.2.5-gentoo x86_64
Distribution: "Gentoo Base System release 2.0.3"

-- Information about the crash:
- What I was doing when the application crashed:

Open a blank document, select "spreadsheet shape" from available shapes, click into the document view. calligra instantly crashes.
Other shapes (notes, text, image, spiral, ...) work without a problem.

I know, the backtrace has only 2 stars. But it's better then having no backtrace, or this crash in the stable release.

-- Backtrace:
Application: Calligra Words (kdeinit4), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f1f26897760 (LWP 15683))]

Thread 2 (Thread 0x7f1f0635c700 (LWP 15685)):
#0  0x00007f1f23ea49c3 in poll () from /lib64/libc.so.6
#1  0x00007f1f20e96148 in g_main_context_iterate.isra.21 () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f1f20e965f9 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f1f254d7106 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f1f254a7a52 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f1f254a7ca7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f1f253a9ca7 in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f1f25487f8f in QInotifyFileSystemWatcherEngine::run() () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f1f253acccb in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f1f25116e2c in start_thread () from /lib64/libpthread.so.0
#10 0x00007f1f23ead55d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f1f26897760 (LWP 15683)):
[KCrash Handler]
#6  0x00007f1f12aa0a1a in KoCreateShapeStrategy::KoCreateShapeStrategy(KoCreateShapesTool*, QPointF const&) () from /usr/lib64/libflake.so.9
#7  0x00007f1f12aaf8a4 in KoCreateShapesTool::createStrategy(KoPointerEvent*) () from /usr/lib64/libflake.so.9
#8  0x00007f1f12aaf649 in KoInteractionTool::mousePressEvent(KoPointerEvent*) () from /usr/lib64/libflake.so.9
#9  0x00007f1f12a513c5 in KoToolProxy::mousePressEvent(KoPointerEvent*) () from /usr/lib64/libflake.so.9
#10 0x00007f1f12a5151b in KoToolProxy::mousePressEvent(QMouseEvent*, QPointF const&) () from /usr/lib64/libflake.so.9
#11 0x00007f1f0c6e8e20 in KWCanvas::mousePressEvent(QMouseEvent*) () from /usr/lib64/libwordsprivate.so.9
#12 0x00007f1f246947f3 in QWidget::event(QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#13 0x00007f1f24641c34 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#14 0x00007f1f24647db9 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#15 0x00007f1f26284936 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#16 0x00007f1f254a8c3c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#17 0x00007f1f24642bf2 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/qt4/libQtGui.so.4
#18 0x00007f1f246bda78 in QETWidget::translateMouseEvent(_XEvent const*) () from /usr/lib64/qt4/libQtGui.so.4
#19 0x00007f1f246bc88a in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#20 0x00007f1f246e3b7a in x11EventSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/lib64/qt4/libQtGui.so.4
#21 0x00007f1f20e95c41 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#22 0x00007f1f20e963f0 in g_main_context_iterate.isra.21 () from /usr/lib64/libglib-2.0.so.0
#23 0x00007f1f20e965f9 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#24 0x00007f1f254d709f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#25 0x00007f1f246e381e in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#26 0x00007f1f254a7a52 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#27 0x00007f1f254a7ca7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#28 0x00007f1f254ac6d5 in QCoreApplication::exec() () from /usr/lib64/qt4/libQtCore.so.4
#29 0x00007f1f143a01ed in kdemain () from /usr/lib64/libkdeinit4_calligrawords.so
#30 0x0000000000408a3a in launch(int, char const*, char const*, char const*, int, char const*, bool, char const*, bool, char const*) ()
#31 0x0000000000409b66 in handle_launcher_request(int, char const*) [clone .isra.15] ()
#32 0x000000000040a08f in handle_requests(int) ()
#33 0x00000000004059d8 in main ()

Reported using DrKonqi
Comment 1 Camilla Boemann 2012-02-14 13:56:04 UTC
it doesn't crash for me although the shape itself is not working very well

It may be you compilation/installation has gone wrong somehow
Comment 2 Franz Trischberger 2012-03-22 08:13:10 UTC
I looked deeper into this:

(gdb) next
37      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
39      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
37      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
40      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
41      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
42      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
44      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
47      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 
50      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) 

Program received signal SIGSEGV, Segmentation fault.
KoCreateShapeStrategy::KoCreateShapeStrategy (this=0x26554f0, tool=<optimized out>, clicked=...) at /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp:50
50      in /var/tmp/paludis/app-office-calligra-2.3.87/work/calligra-2.3.87/libs/flake/tools/KoCreateShapeStrategy.cpp
(gdb) print shape
$7 = (KoShape *) 0x0       
(gdb) print parent
$9 = (KoCreateShapesTool *) 0x2669400
(gdb) print parent->shapeId 
$10 = {QString (const KoCreateShapesTool * const)} 0x7eff2343bad0 <KoCreateShapesTool::shapeId() const>
(gdb) print parent->shapeId()
$11 = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 19094}, alloc = 0, size = 0, data = 0x60d5fa, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, 
  static shared_empty = {ref = {_q_value = 219}, alloc = 0, size = 0, data = 0x7eff361bd8ba, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x1fe59f0, static codecForCStrings = 0x0}

So shape is 0 in this context, because parent->shapeId() returned an empty string. Where could I look next?
Comment 3 Camilla Boemann 2012-03-22 08:27:10 UTC
in sheets/shape/TableShape.cpp line 88

the constructor needs to call:
setShapeId(id);

where id is some unique string for example: "tableshape"
Comment 4 Franz Trischberger 2012-03-23 08:08:04 UTC
Sorry, it was NOT the shapeId. I printed the value in gdb, and that just returned an empty string.
The problem seems to be bound to localization. I am running with german localization. The query in KoShapeFactoryBase.cpp:245 asks for "Name == 'Spreadsheet Shape'". I only get a non-empty offers list, when i ask for "Name == 'Tabellenobjekt'". I am not sure where to fix this.
Comment 5 Franz Trischberger 2012-03-23 08:09:31 UTC
Sorry, incomplete sentence...
>> when i ask for "Name == 'Tabellenobjekt'" it works.
Comment 6 Franz Trischberger 2012-03-23 09:00:34 UTC
This patch fixes the crash, when running german calligrawords in a german kde-session. When running calligrawords in another localization then the session-localization (e.g.english words in german session) it still will crash.


=====

--- sheets/shape/TableShapeFactory.cpp.org	2012-03-23 09:33:02.258388407 +0100
+++ sheets/shape/TableShapeFactory.cpp	2012-03-23 09:27:13.422362087 +0100
@@ -47,7 +47,7 @@
 
 
 TableShapeFactory::TableShapeFactory()
-    : KoShapeFactoryBase(TableShapeId, i18n("Spreadsheet"), "Spreadsheet Shape")
+    : KoShapeFactoryBase(TableShapeId, i18n("Spreadsheet"), i18n("Spreadsheet Shape"))
 {
     setToolTip(i18n("Spreadsheet Shape"));
     setIcon("spreadsheetshape");
Comment 7 Camilla Boemann 2012-03-23 17:04:47 UTC
this is not really a words bug but relted to sheets
Comment 8 Camilla Boemann 2012-03-25 20:03:24 UTC
*** Bug 296690 has been marked as a duplicate of this bug. ***
Comment 9 Halla Rempt 2012-03-29 13:32:45 UTC
Git commit af29c8a7a9d67b476b4de68604e01f1558181b12 by Boudewijn Rempt.
Committed on 29/03/2012 at 15:32.
Pushed by rempt into branch 'master'.

Fix inserting table shape in non-english locale

Comparing a translated name with a fixed text isn't going to work...
Related: bug 297029

Okay to backport to 2.4?

M  +2    -0    libs/flake/KoDeferredShapeFactoryBase.h
M  +2    -7    libs/flake/KoShapeFactoryBase.cpp
M  +2    -0    sheets/shape/TableShapeDeferredFactory.h
M  +1    -1    sheets/shape/TableShapeFactory.cpp
M  +1    -0    sheets/shape/spreadsheetshape-deferred.desktop

http://commits.kde.org/calligra/af29c8a7a9d67b476b4de68604e01f1558181b12
Comment 10 Halla Rempt 2012-03-29 13:55:08 UTC
Git commit 0f96e4b78756deaba77b2d8d486ea5585bd8f652 by Boudewijn Rempt.
Committed on 29/03/2012 at 15:32.
Pushed by rempt into branch 'calligra/2.4'.

Fix inserting table shape in non-english locale

Comparing a translated name with a fixed text isn't going to work...
Related: bug 297029

Okay to backport to 2.4?

M  +2    -0    libs/flake/KoDeferredShapeFactoryBase.h
M  +2    -7    libs/flake/KoShapeFactoryBase.cpp
M  +2    -0    sheets/shape/TableShapeDeferredFactory.h
M  +1    -1    sheets/shape/TableShapeFactory.cpp
M  +1    -0    sheets/shape/spreadsheetshape-deferred.desktop

http://commits.kde.org/calligra/0f96e4b78756deaba77b2d8d486ea5585bd8f652
Comment 11 Franz Trischberger 2012-03-29 14:04:10 UTC
Thanks, this solves the issues.
Patch applied to calligra-2.3.92.