[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#693241: qtcreator: SOFT ASSERT: "i != -1" in file taskmodel.cpp, line 172



On Wed, Nov 14, 2012 at 05:01:52PM +0100, Paul Menzel wrote:
> I am not sure if that is the cause of the crash, but I was able to find
> an upstream issue for it [1]. And we are lucky, that it is marked as
> fixed in Qt Creator 2.6. It would be great if the patch could be
> backported.

Can you apply the attached patch to qtcreator's source code, and see
if that fixes the crash for you?


- Adam


-- 
Adam Majer
adamm@zombino.com
commit b8aeadc3eb84bc1292af84f33a1eb1fbe23e5872
Author: Daniel Teske <daniel.teske@nokia.com>
Date:   Mon May 14 13:39:29 2012 +0200

    TaskHub: emit taskAdded before adding the task to a document
    
    As the adding to the document calls updateTaskLineNumber(), which will
    emit a signal. The TaskModel needs to know the task before getting that
    signal.
    
    Task-number: QTCREATORBUG-7401
    
    Change-Id: I35deba8696adc14199c6c56e45c414016e094088
    Reviewed-by: Daniel Teske <daniel.teske@nokia.com>

diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp
index a7fdde5..4d4ce82 100644
--- a/src/plugins/projectexplorer/taskhub.cpp
+++ b/src/plugins/projectexplorer/taskhub.cpp
@@ -114,10 +114,12 @@ void TaskHub::addTask(Task task)
         TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible);
         mark->setIcon(taskTypeIcon(task.type));
         mark->setPriority(TextEditor::ITextMark::LowPriority);
-        mark->init();
         task.addMark(mark);
+        emit taskAdded(task);
+        mark->init();
+    } else {
+        emit taskAdded(task);
     }
-    emit taskAdded(task);
 }
 
 void TaskHub::clearTasks(const Core::Id &categoryId)

Reply to: