Bug 374530 - Crash when adding message to sequence diagram
Summary: Crash when adding message to sequence diagram
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.21.0 (KDE Applications 16.12.0)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-04 11:21 UTC by Clemens John
Modified: 2017-03-12 19:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.21.2 (KDE Applications 16.12.2)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Clemens John 2017-01-04 11:21:15 UTC
Umbrello crashes (segmentation fault) when adding a message to a sequence diagram. Using Archlinux.

Steps to reproduce:
 * Open Umbrello
 * Add new logical view of type "Sequence diagram"
 * Add two objects
 * Add a message between both objects (doesnt matter if sync. or async.)
 * Crash occurs when clicking on the second lifeline
Comment 1 Ralf Habacker 2017-01-04 11:28:38 UTC
Can you provide a backtrace ?
Comment 2 Clemens John 2017-01-04 11:58:37 UTC
I recompiled umbrello including debug symbols and gdb shows the following:

+++
umbrello: "Create widget : new_class"  [ 2 ]
umbrello: Modified file= "Untitled"
umbrello: Object_Factory::createUMLObject( "" ):  parentPkg is not set, assuming Model_Type  "Logical"
umbrello: "Create UML object : new_class_1"  [ 3 ]
umbrello: Modified file= "Untitled"
umbrello: scene= "sequence diagram"  / object= "new_class_1"
umbrello: Modified file= "Untitled"
umbrello: "Create widget : new_class_1"  [ 3 ]
umbrello: Modified file= "Untitled"
umbrello: virtual void ToolBarStateMessages::setCurrentElement() Object detected
umbrello: virtual void ToolBarStateMessages::setCurrentElement() Object detected

Thread 1 "umbrello" received signal SIGSEGV, Segmentation fault.
__cxxabiv1::__dynamic_cast (src_ptr=0x0, src_type=0xb304a0 <typeinfo for UMLObject>, dst_type=0xb30630 <typeinfo for UMLOperation>, src2dst=0)
    at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/dyncast.cc:50
50      /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/dyncast.cc: Datei oder Verzeichnis nicht gefunden.
(gdb) 
+++

I hope this helps. If you need any further information please let me know!
Comment 3 Ralf Habacker 2017-01-04 12:59:24 UTC
(In reply to Clemens John from comment #2)
> I recompiled umbrello including debug symbols and gdb shows the following:
> 
> +++
> umbrello: "Create widget : new_class"  [ 2 ]
> umbrello: Modified file= "Untitled"
> umbrello: Object_Factory::createUMLObject( "" ):  parentPkg is not set,
> assuming Model_Type  "Logical"
> umbrello: "Create UML object : new_class_1"  [ 3 ]
> umbrello: Modified file= "Untitled"
> umbrello: scene= "sequence diagram"  / object= "new_class_1"
> umbrello: Modified file= "Untitled"
> umbrello: "Create widget : new_class_1"  [ 3 ]
> umbrello: Modified file= "Untitled"
> umbrello: virtual void ToolBarStateMessages::setCurrentElement() Object
> detected
> umbrello: virtual void ToolBarStateMessages::setCurrentElement() Object
> detected
> 
> Thread 1 "umbrello" received signal SIGSEGV, Segmentation fault.
> __cxxabiv1::__dynamic_cast (src_ptr=0x0, src_type=0xb304a0 <typeinfo for
> UMLObject>, dst_type=0xb30630 <typeinfo for UMLOperation>, src2dst=0)
>     at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/dyncast.cc:50
> 50      /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/dyncast.cc: Datei
> oder Verzeichnis nicht gefunden.
> (gdb) 
> +++
> 
> I hope this helps.
yes, I have an idea what's going wrong. The above mentioned crash is known with gcc 6.2 on windows (see bug 373911)

> If you need any further information please let me know!
Yes: 
1. It would be nice to get more backtrace stackframes to be able to get an idea which code path has been used.
2. Which compiler version did you use ? 
3. It would be nice if you would perform the following steps:
3.1 checkout umbrello from branch Applications/16.12 from git repo git://anongit.kde.org/umbrello if not already done
3.2 enable macro checkPointer() unconditional (see the following commit https://cgit.kde.org/umbrello.git/commit/?h=Applications/16.12&id=5b81af759c24895892d8c628fd610ff43f16fd2c for details)
3.2 recompile, retest and report if that helps

Thanks
Comment 4 Ralf Habacker 2017-01-04 13:31:35 UTC
Git commit 21bcc9a769bb0813f313955586f5fe8572e0c228 by Ralf Habacker.
Committed on 04/01/2017 at 13:31.
Pushed by habacker into branch 'Applications/16.12'.

Fix 'Crash when adding message to sequence diagram'.

To support gcc 6.2 on linux it is required to guard
the dynamic_cast's there too.
Related: bug 373911
FIXED-IN:2.21.1 (KDE Applications 16.12.1)

M  +0    -4    umbrello/umlmodel/umlobject.cpp

https://commits.kde.org/umbrello/21bcc9a769bb0813f313955586f5fe8572e0c228
Comment 5 Ralf Habacker 2017-01-04 13:33:07 UTC
(In reply to Ralf Habacker from comment #3)
> 3.2 recompile, retest and report if that helps
Updated gcc to 6.2 on opensuse and got the same crash. Thanks for reporting.
Comment 6 Ralf Habacker 2017-01-04 13:57:26 UTC
Git commit d1df6ae9759f75e3c3b244678c19c7eb009a3c63 by Ralf Habacker.
Committed on 04/01/2017 at 13:57.
Pushed by habacker into branch 'Applications/16.12'.

Fix additional gcc 6.2 "nonnull" warnings caused by checking this pointer.

Renamed macro checkPointer() to uCheckPointerAndReturnIfZero()
and made it public accessable.

M  +2    -1    lib/cppparser/driver.h
M  +19   -0    umbrello/debug/debug_utils.h
M  +29   -38   umbrello/umlmodel/umlobject.cpp

https://commits.kde.org/umbrello/d1df6ae9759f75e3c3b244678c19c7eb009a3c63
Comment 7 Rex Dieter 2017-01-13 16:35:25 UTC
FYI, you introduced non-portable ASM code here, that (apparently?) only works on intel architectures, so umbrello now fails to build elsewhere (like arm, ppc, etc...)
Comment 8 Rex Dieter 2017-01-13 16:37:20 UTC
The error I'm seeing:

{standard input}: Assembler messages:
{standard input}:8263: Error: unrecognized opcode: `test'
{standard input}:8263: Error: unrecognized opcode: `jne'
Comment 9 Kevin Kofler 2017-01-13 17:12:15 UTC
Please revert this non-portable patch and use -fno-delete-null-pointer-checks instead. (That is a GCC switch, but your inline assembly is also GCC-only!)

Rex, you will want to just revert the patch in Fedora. I think we are already/still using -fno-delete-null-pointer-checks across all Qt/KDE stuff (may be worth looking into dropping that at some point, I think Qt itself was fixed, and most other stuff is getting fixed, too, or at least adds the switch itself), so at this time, reverting the patch will NOT reintroduce this bug on Fedora.
Comment 10 Kevin Kofler 2017-01-13 18:18:54 UTC
Reopening because the fix is not acceptable. (It breaks the build on everything except GCC on x86.)
Comment 11 Ralf Habacker 2017-01-14 10:49:46 UTC
Git commit ce147ad93100a0d296f1c5958fcb7bf70c9d70af by Ralf Habacker.
Committed on 14/01/2017 at 10:45.
Pushed by habacker into branch 'Applications/16.12'.

Use gcc buildin null pointer check to remove x86 limitation of previous implementation.

Thanks to Kevin Kofler for pointing out.

MSVC dynamic_cast null pointer support has been checked and proved by Daniel Wendt.
FIXED-IN:2.12.2 (KDE Applications 16.12.2)

M  +4    -0    CMakeLists.txt
M  +0    -2    lib/cppparser/driver.h
M  +0    -19   umbrello/debug/debug_utils.h
M  +28   -29   umbrello/umlmodel/umlobject.cpp

https://commits.kde.org/umbrello/ce147ad93100a0d296f1c5958fcb7bf70c9d70af
Comment 12 Clemens John 2017-01-17 11:18:09 UTC
I just want to leave some feedback, that the bug is fixed for me in Version 2.21.1. Thank you!