[vlmc-devel] commit: Timeline Bug Fix: Check and delete item. (Rohit Yadav )
git at videolan.org
git at videolan.org
Mon Oct 11 18:34:29 CEST 2010
vlmc | branch: master | Rohit Yadav <rohityadav89 at gmail.com> | Mon Oct 11 22:18:01 2010 +0530| [c95b4fe55ec7c0139f66f6a965fe06827964ebce] | committer: Rohit Yadav
Timeline Bug Fix: Check and delete item.
Checks that if the item is deleted, respective pointer is nullified.
NOTE: This bug fix introduces a minor bug among timeline layers.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=c95b4fe55ec7c0139f66f6a965fe06827964ebce
---
src/Gui/timeline/TracksView.cpp | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 560a462..ae8ab59 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -750,6 +750,10 @@ TracksView::removeItem( TrackWorkflow *tw, const QUuid &uuid )
void
TracksView::removeItem( AbstractGraphicsItem *item )
{
+ // Is it the same item captured by mouse events
+ if( item == m_actionItem )
+ m_actionItem = NULL;
+
m_itemsLoaded.remove( item->uuid() );
delete item;
updateDuration();
@@ -934,8 +938,12 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
event->buttons() == Qt::LeftButton &&
m_action == TracksView::Move )
{
+ // Check if the item exists or has been removed
+ if ( m_actionItem == NULL )
+ return;
+
//Moving item.
- m_actionItem->setOpacity( 0.6 );
+ m_actionItem->setOpacity( 0.6F );
if ( m_actionRelativeX < 0 )
m_actionRelativeX = event->pos().x() - mapFromScene( m_actionItem->pos() ).x();
QPoint pos( event->pos().x() - m_actionRelativeX, event->pos().y() );
@@ -1115,8 +1123,11 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
{
if ( m_action == TracksView::Move )
{
- Q_ASSERT( m_actionItem );
- m_actionItem->setOpacity( 1.0 );
+ // Check if the item exists or has been removed
+ if ( m_actionItem == NULL )
+ return;
+
+ m_actionItem->setOpacity( 1.0F );
GraphicsEffectItem *effectItem = qgraphicsitem_cast<GraphicsEffectItem*>( m_actionItem );
//Check if the item moved.
More information about the Vlmc-devel
mailing list