Bug 341483 - Kdevelop crashes while typing "def a" if certain file is imported
Summary: Kdevelop crashes while typing "def a" if certain file is imported
Status: VERIFIED FIXED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: general (show other bugs)
Version: git master
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-02 10:01 UTC by Hai Zaar
Modified: 2014-12-02 13:18 UTC (History)
1 user (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 Hai Zaar 2014-12-02 10:01:48 UTC
If I have a file that imports "viewsets" from django-rest-frameworks project, kdevelop crashes while trying to type new method, i.e. "def a..", in any class that extends classes from "viewsets" file. See reproduction steps below for details.

kdevelop version 4.7.0
kdev-python version 1.7.0; also tried compiling git master
python version 2.7.6



Reproducible: Always

Steps to Reproduce:
1. cd /tmp/
2. virtualenv dead
3. source /tmp/dead/bin/activate
4. mkdir /tmp/dead-code
5. cd /tmp/dead-code
6. pip install Django==1.7.1 djangorestframework==3.0.0
7. PYTHONPATH=/tmp/dead/lib/python2.7/site-packages kdevelop -n dead
8. import /tmp/dead-code directory as a project into kdevelop
9. create new file "dead.py" with the following contents:

from rest_framework import viewsets


class MyViewSet(viewsets.ModelViewSet):

10.  Wait until everything gets parsed and "viewsets.ModelViewSet" in class definition becomes green.
11.  Start new line after class definition and start typing "def a". Once you type "a", kdevelop will crash. I.e. dead.py would be looking as follows:

from rest_framework import viewsets


class MyViewSet(viewsets.ModelViewSet):
    def a


=============

If you relaunch kdevelop and tell him to recover the file, it will crash again.


Here is the console log with debug enabled after I've started to type "def a":

kdevelop(1176)/kdevplatform (language) KDevelop::StaticAssistantsManager::Private::eventuallyStartAssistant: Trying to find assistants for language "Python"
kdevelop(1176)/kdevplatform (genericprojectmanager) KDevelop::AbstractFileManagerPlugin::Private::created: created: "/tmp/dead-code/.dead.py.kate-swp"
kdevelop(1176)/kdevplatform (language) KDevelop::StaticAssistantsManager::Private::eventuallyStartAssistant: Trying to find assistants for language "Python"
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: completion invoked for context 0x4fdf0a0
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: Found context is not current. Its revision is
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: apply specialization: (5, 4)
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: after specialization: "MyViewSet" [ (4, 40)  ->  (7, 0) ]
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: context is set to 0x4ecc190
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionWorker::computeCompletions: "MyViewSet"
kdevelop(1176)/kdevelop (python support) Python::CodeHelpers::endsInside: Checking for comment line: "
    "
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionWorker::computeCompletions: added text: "d"
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::PythonCodeCompletionContext: "
    " (5, 4) "MyViewSet" [(4, 40) ,  (7, 0) ]
kdevelop(1176)/kdevelop (python support) Python::CodeHelpers::endsInside: Checking for comment line: "
    "
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::summonParentForEventualCall: next call: QPair(-1,-1)
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::summonParentForEventualCall: "offset 0 position 0: status 1, expression 
"
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::setCompletionContext: got completion-context with  0 ungrouped elements
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::completionItems: Line:  5
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::completionItems: Completion type: 5
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::foundDeclarations: got completion-context with  0 ungrouped elements
kdevelop(1176)/kdevplatform (language) KDevelop::StaticAssistantsManager::Private::eventuallyStartAssistant: Trying to find assistants for language "Python"
kdevelop(1176)/kdevplatform (language) KDevelop::StaticAssistantsManager::Private::eventuallyStartAssistant: Trying to find assistants for language "Python"
kdevelop(1176)/kdevplatform (language) KDevelop::StaticAssistantsManager::Private::eventuallyStartAssistant: Trying to find assistants for language "Python"
kdevelop(1176)/kdevplatform (language) KDevelop::StaticAssistantsManager::Private::eventuallyStartAssistant: Trying to find assistants for language "Python"
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: completion invoked for context 0x4fdf0a0
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: Found context is not current. Its revision is
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: apply specialization: (5, 8)
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: after specialization: "MyViewSet" [ (4, 40)  ->  (7, 0) ]
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::completionInvokedInternal: context is set to 0x4ecc190
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionWorker::computeCompletions: "MyViewSet"
kdevelop(1176)/kdevelop (python support) Python::CodeHelpers::endsInside: Checking for comment line: "
    def "
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionWorker::computeCompletions: added text: "a"
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::PythonCodeCompletionContext: "
    def " (5, 8) "MyViewSet" [(4, 40) ,  (7, 0) ]
kdevelop(1176)/kdevelop (python support) Python::CodeHelpers::endsInside: Checking for comment line: "
    def "
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::summonParentForEventualCall: next call: QPair(-1,-1)
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::summonParentForEventualCall: "offset 0 position 0: status 1, expression 
offset 5 position 1: status 16, expression 
"
kdevelop(1176)/kdevplatform (language) KDevelop::CodeCompletionModel::setCompletionContext: got completion-context with  0 ungrouped elements
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::completionItems: Line:  5
kdevelop(1176)/kdevelop (python support) Python::PythonCodeCompletionContext::completionItems: Completion type: 6
kdevelop(1176)/kdevplatform (language) KDevelop::DUChainPrivate::loadChain: loading top-context 383
kdevelop(1176)/kdevplatform (language) KDevelop::DUChainPrivate::loadChain: loading top-context 381
kdevelop(1176)/kdevplatform (language) KDevelop::DUChainPrivate::loadChain: loading top-context 382
kdevelop(1176)/kdevplatform (language) KDevelop::DUChainPrivate::loadChain: loading top-context 392
QSocketNotifier: Invalid socket 7 and type 'Read', disabling...
QSocketNotifier: Invalid socket 15 and type 'Read', disabling...
QSocketNotifier: Invalid socket 34 and type 'Read', disabling...
QSocketNotifier: Invalid socket 40 and type 'Read', disabling...
QSocketNotifier: Invalid socket 16 and type 'Read', disabling...
QSocketNotifier: Invalid socket 21 and type 'Read', disabling...
kdevelop: Fatal IO error: client killed
Unable to start Dr. Konqi
Not forwarding the crash to Apport.
Comment 1 Sven Brauch 2014-12-02 12:46:41 UTC
Git commit a723b77167b8d5aad7c9f6a5728a0633967a1f1a by Sven Brauch.
Committed on 02/12/2014 at 12:43.
Pushed by brauch into branch '1.7'.

Fix crash when building completion items for functions with no arguments context

I'm not sure how this situation can happen, but the referenced bug
describes code which triggers the issue. This commit just
fixes the crash which happens in that case.

M  +7    -5    codecompletion/context.cpp

http://commits.kde.org/kdev-python/a723b77167b8d5aad7c9f6a5728a0633967a1f1a
Comment 2 Sven Brauch 2014-12-02 12:46:42 UTC
Git commit 18a70d8597c236189aeeaeac511f4a3439bc13bf by Sven Brauch.
Committed on 02/12/2014 at 12:43.
Pushed by brauch into branch '1.7-py3'.

Fix crash when building completion items for functions with no arguments context

I'm not sure how this situation can happen, but the referenced bug
describes code which triggers the issue. This commit just
fixes the crash which happens in that case.

M  +7    -5    codecompletion/context.cpp

http://commits.kde.org/kdev-python/18a70d8597c236189aeeaeac511f4a3439bc13bf
Comment 3 Sven Brauch 2014-12-02 12:46:43 UTC
Git commit a5918fac3feffc3b3ef00f06a01e00f03bdf0c83 by Sven Brauch.
Committed on 02/12/2014 at 12:43.
Pushed by brauch into branch 'frameworks'.

Fix crash when building completion items for functions with no arguments context

I'm not sure how this situation can happen, but the referenced bug
describes code which triggers the issue. This commit just
fixes the crash which happens in that case.

M  +7    -5    codecompletion/context.cpp

http://commits.kde.org/kdev-python/a5918fac3feffc3b3ef00f06a01e00f03bdf0c83
Comment 4 Sven Brauch 2014-12-02 12:47:46 UTC
Thanks for the precise instructions! I'm not entirely sure how the bug is triggered, but this fixes it for now.
Comment 5 Hai Zaar 2014-12-02 13:13:24 UTC
Thank you so much for the quick fix!
I can confirm that it working fine now.

Long live kdev-python!
Comment 6 Sven Brauch 2014-12-02 13:18:44 UTC
Thanks, cool :-)