[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Review Request: Workaround Taskbar ghost entries bug
From:       Craig Drummond <craig () kde ! org>
Date:       2011-10-05 20:54:54
Message-ID: 201110052154.54629.craig () kde ! org
[Download RAW message or body]

On Wednesday 05 Oct 2011, Aaron J. Seigo wrote:
> On Wednesday, October 5, 2011 20:08:55 Craig Drummond wrote:
> > I don't know if its related, but whilst working on IconTasks I noticed
> > that items set to be deleted via deleteLater (in
> > TaskGroupItem::itemRemoved and TaskManager::TaskItem) were not being
> > deleted until after the app (plasmoidviewer / plasma-desktop) had
> > terminated.
> 
> the only way deleteLater() will not delete is if the event loop is never
> entered. so i'm very suspicious about this claim; 

I agree, that it looks odd. But its what I saw. The attached 
deleteLaterDebug.diff shows the output I added, output.log shows what happens.
At 21:49:35 the item is marked deleteLater, I waited 8 seconds before closing 
plasmoidviewer - and you can see the item being destroyed then.

> are you sure it was the same object (e.g. same address in memory?), and not
> just a task item with, e.g., the same name?

Yes, I outputed the address of the item just to be sure. Again, see the 
output.log

> > I worked-around this by using a single-shot QTimer to call deleteLater()
> > - but this seems a little hacky to me.
> 
> can you share the patch that does this so i can see what is going on first-
> hand? thanks! :)

Attached as deleteLater-4.7.patch. I'll I've done is replace two deleteLater 
calls with a QTimer::singleShot which calls the deleteLater.

> > p.s. I also noticed a bug with AbstractTaskItem::setGeometry(). If the
> > passed in geometry is the same as the current geometry, the layout
> > animation and update-geometry timers need to be stopped. Otherwise a gap
> > can appear when a group of items is closed all at once.
> 
> patches very much welcome for these kinds of issues :)

I did intend to - but made too many changes. I'll try to create a patch 
against the standard taskbar for each change.

Craig.

["deleteLater-4.7.patch" (text/x-patch)]

diff --git a/libs/taskmanager/taskitem.cpp b/libs/taskmanager/taskitem.cpp
index 6921d87..d8eb137 100644
--- a/libs/taskmanager/taskitem.cpp
+++ b/libs/taskmanager/taskitem.cpp
@@ -81,7 +81,7 @@ void TaskItem::taskDestroyed()
 {
     d->startupTask = 0;
     d->task.clear();
-    deleteLater();
+    QTimer::singleShot(0, this, SLOT(deleteLater()));
 }
 
 void TaskItem::setTaskPointer(TaskPtr task)
diff --git a/plasma/desktop/applets/tasks/taskgroupitem.cpp \
b/plasma/desktop/applets/tasks/taskgroupitem.cpp index 5ff5896..70d8bdc 100644
--- a/plasma/desktop/applets/tasks/taskgroupitem.cpp
+++ b/plasma/desktop/applets/tasks/taskgroupitem.cpp
@@ -574,7 +574,7 @@ void \
TaskGroupItem::itemRemoved(TaskManager::AbstractGroupableItem * groupableIt  }
 
     item->close();
-    item->deleteLater();
+    QTimer::singleShot(0, item, SLOT(deleteLater()));
 }
 
 bool TaskGroupItem::isWindowItem() const


["deleteLaterDebug.diff" (text/x-patch)]

diff --git a/plasma/desktop/applets/tasks/abstracttaskitem.cpp \
b/plasma/desktop/applets/tasks/abstracttaskitem.cpp index 00140ef..1c82c93 100644
--- a/plasma/desktop/applets/tasks/abstracttaskitem.cpp
+++ b/plasma/desktop/applets/tasks/abstracttaskitem.cpp
@@ -21,6 +21,7 @@
 
 // Own
 #include "abstracttaskitem.h"
+#include <QtCore/QTime>
 
 // Qt
 #include <QApplication>
@@ -149,6 +150,7 @@ void AbstractTaskItem::setPreferredOnscreenSize()
 
 AbstractTaskItem::~AbstractTaskItem()
 {
+    qDebug() << QTime::currentTime() << "DESTROY:" << (void *)this;
     stopWindowHoverEffect();
     emit destroyed(this);
     Plasma::ToolTipManager::self()->unregisterWidget(this);
diff --git a/plasma/desktop/applets/tasks/taskgroupitem.cpp \
b/plasma/desktop/applets/tasks/taskgroupitem.cpp index 5ff5896..618237c 100644
--- a/plasma/desktop/applets/tasks/taskgroupitem.cpp
+++ b/plasma/desktop/applets/tasks/taskgroupitem.cpp
@@ -20,6 +20,7 @@
 
 // Own
 #include "taskgroupitem.h"
+#include <QtCore/QTime>
 
 // Qt
 #include <QGraphicsSceneContextMenuEvent>
@@ -574,6 +575,7 @@ void \
TaskGroupItem::itemRemoved(TaskManager::AbstractGroupableItem * groupableIt  }
 
     item->close();
+    qDebug() << QTime::currentTime() << "TaskGroupItem::itemRemoved Calling \
deleteLater on :" << (void *)item;  item->deleteLater();
 }
 


["output.log" (text/x-log)]

QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
QFileSystemWatcher: failed to add paths: /home/craig/.config/ibus/bus
QTime("21:49:26") TaskGroupItem::itemRemoved Calling deleteLater on : 0x9f8b960 
QTime("21:49:26") DESTROY: 0x9f8b960 
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 20 (X_GetProperty)
  Resource id:  0x4a00143
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 20 (X_GetProperty)
  Resource id:  0x4a00143
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 20 (X_GetProperty)
  Resource id:  0x4a00143
QTime("21:49:35") TaskGroupItem::itemRemoved Calling deleteLater on : 0x9fb08c8 
QTime("21:49:43") DESTROY: 0x9fb08c8 
QTime("21:49:43") DESTROY: 0x9f6d708 
QTime("21:49:43") DESTROY: 0x9e96360 
QTime("21:49:43") DESTROY: 0x9f88188 
QTime("21:49:43") DESTROY: 0x9f57de8 
QTime("21:49:43") DESTROY: 0x9e983e8 
QTime("21:49:43") DESTROY: 0x9e98930 
QTime("21:49:43") DESTROY: 0x9e97d78 
QTime("21:49:43") DESTROY: 0x9f82b28 


_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic