Summary: | KDevelop crashed when trying to rename folder under cmake project manager | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Chaos A.D. <chaos-ad> |
Component: | Build tools: CMake | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | aleixpol, chaos-ad, valir |
Priority: | VHI | ||
Version: | 4.1.60 | ||
Target Milestone: | 4.2.0 | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
New crash information added by DrKonqi
New crash information added by DrKonqi New crash when renaming folder |
Description
Chaos A.D.
2010-11-12 09:38:20 UTC
I use CMake project manager. It crashes after displaying diff in CMakeLists.txt, and I press OK. is this the most recent kdevelop master? can someone reproduce? Yes, i'm currently on the top of master. It is 100% reproducible for me, but I haven't much time to debug it myself. Though, i noticed that when we returning from project()->projectFileManager()->renameFolder(this, dest) [projectmodel.cpp:526], subsequent call to setUrl(dest) is crashed. Perhaps, due to deleted this pointer, since CMakeManager receives notifications from directory watcher from inise of ApplyChangesWidget::exec() [cmakemanager.cpp:1459], and, probably, rebuild the project item tree in void CMakeManager::dirtyFile(const QString & dirty) [cmakemanager.cpp:766]. Please, check this out :) now I had the time to try it out and could confirm it. Aleix, can you please fix this and write unit tests? This is broken far too often imo... part of the valgrind log: ==14805== Invalid read of size 8 ==14805== at 0x84ABB0D: QString::operator=(QString const&) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0xB46F04A: KDevelop::ProjectBaseItem::setText(QString const&) (projectmodel.cpp:275) ==14805== by 0xB46FCC5: KDevelop::ProjectBaseItem::setUrl(KUrl const&) (projectmodel.cpp:363) ==14805== by 0xB470675: KDevelop::ProjectFolderItem::rename(QString const&) (projectmodel.cpp:528) ==14805== by 0x3542C320: ProjectManagerViewPlugin::renameItemFromContextMenu() (projectmanagerviewplugin.cpp:522) ==14805== by 0x3542CC4C: ProjectManagerViewPlugin::qt_metacall(QMetaObject::Call, int, void**) (projectmanagerviewplugin.moc:126) ==14805== by 0x856433E: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0x8C4FC41: QAction::triggered(bool) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8C4FE39: QAction::activate(QAction::ActionEvent) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x908C2B2: ??? (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x9092249: ??? (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x7E38E9C: KMenu::mouseReleaseEvent(QMouseEvent*) (in /usr/lib/libkdeui.so.5.5.0) ==14805== by 0x8CA7977: QWidget::event(QEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x909344A: QMenu::event(QEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8C562B3: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8C5B649: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x7D69225: KApplication::notify(QObject*, QEvent*) (in /usr/lib/libkdeui.so.5.5.0) ==14805== by 0x40528B: KDevelopApplication::notify(QObject*, QEvent*) (main.cpp:90) ==14805== by 0x854EEBB: QCoreApplication::notifyInternal(QObject*, QEvent*) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0x8C572B4: QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8CD5BC3: ??? (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8CD4028: QApplication::x11ProcessEvent(_XEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8CFB591: ??? (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0xF4B8BF2: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.2600.0) ==14805== by 0xF4B93CF: ??? (in /usr/lib/libglib-2.0.so.0.2600.0) ==14805== Address 0x158be900 is 32 bytes inside a block of size 72 free'd ==14805== at 0x4C23F8E: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14805== by 0xB46E48E: KDevelop::ProjectBaseItem::~ProjectBaseItem() (projectmodel.cpp:152) ==14805== by 0xB470255: KDevelop::ProjectFolderItem::~ProjectFolderItem() (projectmodel.cpp:475) ==14805== by 0x2073B873: KDevelop::ProjectBuildFolderItem::~ProjectBuildFolderItem() (in /home/development/projects/compiled/kde4/lib/kde4/kdevcmakemanager.so) ==14805== by 0x2073D767: CMakeFolderItem::~CMakeFolderItem() (in /home/development/projects/compiled/kde4/lib/kde4/kdevcmakemanager.so) ==14805== by 0x2073D799: CMakeFolderItem::~CMakeFolderItem() (cmakemodelitems.h:66) ==14805== by 0x207558DD: void qDeleteAll<QList<KDevelop::ProjectBaseItem*>::const_iterator>(QList<KDevelop::ProjectBaseItem*>::const_iterator, QList<KDevelop::ProjectBaseItem*>::const_iterator) (qalgorithms.h:322) ==14805== by 0x2075013C: void qDeleteAll<QList<KDevelop::ProjectBaseItem*> >(QList<KDevelop::ProjectBaseItem*> const&) (qalgorithms.h:330) ==14805== by 0x20743F7E: CMakeManager::deletedWatched(QString const&) (cmakemanager.cpp:760) ==14805== by 0x2074A402: CMakeManager::qt_metacall(QMetaObject::Call, int, void**) (cmakemanager.moc:100) ==14805== by 0x856433E: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0x4F330E4: KDirWatch::deleted(QString const&) (in /usr/lib/libkdecore.so.5.5.0) ==14805== by 0x4F3312F: KDirWatch::setDeleted(QString const&) (in /usr/lib/libkdecore.so.5.5.0) ==14805== by 0x4F33220: KDirWatch::qt_metacall(QMetaObject::Call, int, void**) (in /usr/lib/libkdecore.so.5.5.0) ==14805== by 0x8563199: QObject::event(QEvent*) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0x8C562B3: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x8C5ADC9: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQtGui.so.4.7.1) ==14805== by 0x7D69225: KApplication::notify(QObject*, QEvent*) (in /usr/lib/libkdeui.so.5.5.0) ==14805== by 0x40528B: KDevelopApplication::notify(QObject*, QEvent*) (main.cpp:90) ==14805== by 0x854EEBB: QCoreApplication::notifyInternal(QObject*, QEvent*) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0x85526E4: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0x8579DB2: ??? (in /usr/lib/libQtCore.so.4.7.1) ==14805== by 0xF4B8BF2: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.2600.0) ==14805== by 0xF4B93CF: ??? (in /usr/lib/libglib-2.0.so.0.2600.0) ==14805== by 0xF4B966C: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.2600.0) Created attachment 53508 [details]
New crash information added by DrKonqi
kdevelop (4.1.0) on KDE Platform 4.5.3 (KDE 4.5.3) using Qt 4.7.0
This crash occured just after clikcing the OK button of the rename folder dialog, inside an existing project.
-- Backtrace (Reduced):
#8 0xb5b20889 in KDevelop::ProjectFolderItem::rename(QString const&) () from /usr/lib/libkdevplatformproject.so.2
[...]
[...]
[...]
[...]
#13 0xb649b0ad in QAction::triggered (this=0xa026508, _t1=false) at .moc/release-shared/moc_qaction.cpp:263
#14 0xb649b34b in QAction::activate (this=0xa026508, event=QAction::Trigger) at kernel/qaction.cpp:1256
#15 0xb694a1f5 in QMenuPrivate::activateCausedStack (this=0x9ffaa40, causedStack=..., action=0xa026508, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:993
#16 0xb6950df7 in QMenuPrivate::activateAction (this=0x9ffaa40, action=0xa026508, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:1085
commit 9453575c70b5337984c792a2477971874c84dd3f branch master Author: Aleix Pol <aleixpol@kde.org> Date: Thu Nov 25 02:31:28 2010 +0100 Make the build tool responsible for renaming the items when rename is triggered (it was already being done, but twice in abstractfilemanagerplugin). BUG: 256660 diff --git a/project/projectmodel.cpp b/project/projectmodel.cpp index d609406..1bc5189 100644 --- a/project/projectmodel.cpp +++ b/project/projectmodel.cpp @@ -481,6 +481,8 @@ void ProjectFolderItem::setUrl( const KUrl& url ) KUrl copy(url); copy.adjustPath(KUrl::AddTrailingSlash); ProjectBaseItem::setUrl(copy); + + propagateRename(url); } ProjectFolderItem *ProjectFolderItem::folder() const @@ -498,16 +500,18 @@ QString ProjectFolderItem::folderName() const return url().fileName(); } -void propagateRename( const KDevelop::ProjectFolderItem* item, const KUrl& newBase) +void ProjectFolderItem::propagateRename(const KUrl& newBase) const { KUrl url = newBase; url.addPath("dummy"); - foreach( KDevelop::ProjectBaseItem* child, item->children() ) + foreach( KDevelop::ProjectBaseItem* child, children() ) { url.setFileName( child->text() ); child->setUrl( url ); - if ( child->folder() ) { - propagateRename( child->folder(), url ); + + const ProjectFolderItem* folder = child->folder(); + if ( folder ) { + folder->propagateRename( url ); } } } @@ -525,10 +529,9 @@ ProjectBaseItem::RenameStatus ProjectFolderItem::rename(const QString& newname) { if( !project() || project()->projectFileManager()->renameFolder(this, dest) ) { - setUrl( dest ); - propagateRename(this, dest); return ProjectBaseItem::RenameOk; - } else + } + else { return ProjectBaseItem::ProjectManagerRenameFailed; } @@ -613,9 +616,9 @@ ProjectBaseItem::RenameStatus ProjectFileItem::rename(const QString& newname) { if( !project() || project()->projectFileManager()->renameFile(this, dest) ) { - setUrl( dest ); return ProjectBaseItem::RenameOk; - } else + } + else { return ProjectBaseItem::ProjectManagerRenameFailed; } diff --git a/project/projectmodel.h b/project/projectmodel.h index f247b1a..4ae32fb 100644 --- a/project/projectmodel.h +++ b/project/projectmodel.h @@ -232,6 +232,8 @@ public: virtual QString iconName() const; virtual RenameStatus rename(const QString& newname); + + void propagateRename( const KUrl& newBase ) const; }; commit bfbab5b8d5fff508986715b10ba4cdfd0e85cca1 branch 1.1 Author: Aleix Pol <aleixpol@kde.org> Date: Thu Nov 25 02:31:28 2010 +0100 Make the build tool responsible for renaming the items when rename is triggered (it was already being done, but twice in abstractfilemanagerplugin). BUG: 256660 diff --git a/project/projectmodel.cpp b/project/projectmodel.cpp index 3002fb0..5e3f6e4 100644 --- a/project/projectmodel.cpp +++ b/project/projectmodel.cpp @@ -479,6 +479,8 @@ void ProjectFolderItem::setUrl( const KUrl& url ) KUrl copy(url); copy.adjustPath(KUrl::AddTrailingSlash); ProjectBaseItem::setUrl(copy); + + propagateRename(url); } ProjectFolderItem *ProjectFolderItem::folder() const @@ -496,16 +498,18 @@ QString ProjectFolderItem::folderName() const return url().fileName(); } -void propagateRename( const KDevelop::ProjectFolderItem* item, const KUrl& newBase) +void ProjectFolderItem::propagateRename(const KUrl& newBase) const { KUrl url = newBase; url.addPath("dummy"); - foreach( KDevelop::ProjectBaseItem* child, item->children() ) + foreach( KDevelop::ProjectBaseItem* child, children() ) { url.setFileName( child->text() ); child->setUrl( url ); - if ( child->folder() ) { - propagateRename( child->folder(), url ); + + const ProjectFolderItem* folder = child->folder(); + if ( folder ) { + folder->propagateRename( url ); } } } @@ -523,10 +527,9 @@ ProjectBaseItem::RenameStatus ProjectFolderItem::rename(const QString& newname) { if( !project() || project()->projectFileManager()->renameFolder(this, dest) ) { - setUrl( dest ); - propagateRename(this, dest); return ProjectBaseItem::RenameOk; - } else + } + else { return ProjectBaseItem::ProjectManagerRenameFailed; } @@ -611,9 +614,9 @@ ProjectBaseItem::RenameStatus ProjectFileItem::rename(const QString& newname) { if( !project() || project()->projectFileManager()->renameFile(this, dest) ) { - setUrl( dest ); return ProjectBaseItem::RenameOk; - } else + } + else { return ProjectBaseItem::ProjectManagerRenameFailed; } diff --git a/project/projectmodel.h b/project/projectmodel.h index f247b1a..4ae32fb 100644 --- a/project/projectmodel.h +++ b/project/projectmodel.h @@ -232,6 +232,8 @@ public: virtual QString iconName() const; virtual RenameStatus rename(const QString& newname); + + void propagateRename( const KUrl& newBase ) const; }; Created attachment 54234 [details]
New crash information added by DrKonqi
kdevelop (4.1.60) on KDE Platform 4.5.1 (KDE 4.5.1) using Qt 4.7.0
After creating new folder, it doesn't appear in the project tree, even after several refreshes of parent folder or whole tree. Then, when I tried to close and open project again, KDevelop crashes with attached backtrace.
-- Backtrace (Reduced):
#10 0xb500aabd in KDevelop::ProjectFolderItem::setUrl(KUrl const&) () from /usr/local/lib/libkdevplatformproject.so.3
#12 0xb500aabd in KDevelop::ProjectFolderItem::setUrl(KUrl const&) () from /usr/local/lib/libkdevplatformproject.so.3
#14 0xb500aabd in KDevelop::ProjectFolderItem::setUrl(KUrl const&) () from /usr/local/lib/libkdevplatformproject.so.3
#15 0xaa266122 in CMakeManager::reloadFiles(KDevelop::ProjectFolderItem*) () from /usr/local/lib/kde4/kdevcmakemanager.so
#16 0xaa2665a3 in CMakeManager::parse(KDevelop::ProjectFolderItem*) () from /usr/local/lib/kde4/kdevcmakemanager.so
Chaos: if you can reproduce this, please run kdevelop through valgrind: valgrind --track-origins=yes --num-callers=25 kdevelop and attach the output that produces. Is this still happening? Your problem description sounds more like there's some binary incompatibility than an actual bug. Please reopen if you think it's still wrong. Created attachment 54600 [details]
New crash when renaming folder
How to reproduce this crash in KDevelop 4.1.60 :
- in an existing project managed by CMake plugin, create a folder named test
- confirm changes in the wizard that appears,
- open the CMakeLists.txt and add en empty line (not shure that this step is important, though)
- go to the project explorer and choose "rename" from the "test" folder contextual menu,
- enter name "test1" then click ok to get the crash.
On Wednesday, December 15, 2010 02:56:10 AM Aleix Pol wrote: > https://bugs.kde.org/show_bug.cgi?id=256660 > > > Aleix Pol <aleixpol@gmail.com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|REOPENED |RESOLVED > CC| |aleixpol@gmail.com > Resolution| |FIXED > > I'm trying to reopen this bug, but that seems impossible for me. > > > --- Comment #11 from Aleix Pol <aleixpol gmail com> 2010-12-15 02:56:02 --- > Is this still happening? > Your problem description sounds more like there's some binary > incompatibility than an actual bug. > > Please reopen if you think it's still wrong. Please see the report I attached. The bug is still reproducing on my box. cannot reproduce - are you sure you got the latest code (did you update to the git.kde.org location - gitorious was abandoned!). anyhow, if you can reproduce with current code please open a new report so we can track this properly. Also add a valgrind log for the crash then: valgrind --track-origins=yes --num-callers=50 kdevelop closing this one for now. |