https://bugs.kde.org/show_bug.cgi?id=441058

            Bug ID: 441058
           Summary: Kdevelop crashes when opening a document ([re]storing
                    split views)
           Product: kdevelop
           Version: unspecified
          Platform: Neon Packages
                OS: Linux
            Status: REPORTED
          Keywords: drkonqi
          Severity: crash
          Priority: NOR
         Component: general
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: jonathan.ver...@matfyz.cz
  Target Milestone: ---

Application: kdevelop (5.6.40)

Qt Version: 5.15.3
Frameworks Version: 5.84.0
Operating System: Linux 5.8.0-63-generic x86_64
Windowing System: X11
Drkonqi Version: 5.22.4
Distribution: KDE neon User Edition 5.22

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

I start kdevelop, open a project and then click on any file in the project.
Kdevelop immediately crashes. 

The crash seems to be caused by the code which takes care of (re)storing
working sets,
introduced in commit 89594aed, in particular on line 278 in
`kdevplatform/shell/workingsets/workingset.cpp`
the call to `view->widget()` fails with an assert. The problem is that the view
does not have an initialized widget,
so the `Sublime::View::widget` method tries to create one. However, its not
given any parent, which leads to an assert in
`EditorViewWatcher::viewCreated` deeper in the callstack. 

The following patch seems to fix the problem for me:
```diff

diff --git a/kdevplatform/shell/workingsets/workingset.cpp
b/kdevplatform/shell/workingsets/workingset.cpp
index 60c0946446..45b8c7671a 100644
--- a/kdevplatform/shell/workingsets/workingset.cpp
+++ b/kdevplatform/shell/workingsets/workingset.cpp
@@ -274,7 +274,7 @@ QSplitter* saveFromAreaPrivate(Sublime::AreaIndex *area,
KConfigGroup setGroup,
             }
             ++index;

-            if (!parentSplitter) {
+            if (!parentSplitter && view->hasWidget()) {
                 auto p = view->widget()->parentWidget();
                 while (p && !(parentSplitter = qobject_cast<QSplitter*>(p))) {
                     p = p->parentWidget();

```

however, I do not understand the code enough to know whether its not just
hiding the problem. Perhaps
the correct thing to do would be to provide a proper parent to the
`Sublime::View::widget` method, 
but I don't know what that would be.

If the patch is o.k., I can prepare a pull-request.

The crash can be reproduced every time.

-- Backtrace (Reduced):
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00007f89a24ed859 in __GI_abort () at abort.c:79
#6  0x00007f89a2930bf7 in qt_message_fatal (context=..., message=<synthetic
pointer>...) at global/qlogging.cpp:1914
#7  QMessageLogger::fatal(char const*, ...) const
(this=this@entry=0x7fffcb0f7970, msg=msg@entry=0x7f89a2c3bea0 "ASSERT: \"%s\"
in file %s, line %d") at global/qlogging.cpp:893
#8  0x00007f89a2930003 in qt_assert(char const*, char const*, int)
(assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at
../../include/QtCore/../../src/corelib/global/qlogging.h:90


Possible duplicates by query: bug 440777, bug 440257, bug 438433, bug 429344,
bug 427384.

Reported using DrKonqi

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to