[Ktutorial-commits] SF.net SVN: ktutorial:[341] trunk/ktutorial/ktutorial-library/tests/ extendedi
Status: Alpha
                
                Brought to you by:
                
                    danxuliu
                    
                
            | 
      
      
      From: <dan...@us...> - 2011-10-16 18:07:35
      
     | 
| Revision: 341
          http://ktutorial.svn.sourceforge.net/ktutorial/?rev=341&view=rev
Author:   danxuliu
Date:     2011-10-16 18:07:26 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
Fix test, as the assert may fail if the new object was created at the same memory address as the old one.
Modified Paths:
--------------
    trunk/ktutorial/ktutorial-library/tests/extendedinformation/WidgetHighlighterManagerTest.cpp
Modified: trunk/ktutorial/ktutorial-library/tests/extendedinformation/WidgetHighlighterManagerTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-library/tests/extendedinformation/WidgetHighlighterManagerTest.cpp	2011-10-13 14:29:41 UTC (rev 340)
+++ trunk/ktutorial/ktutorial-library/tests/extendedinformation/WidgetHighlighterManagerTest.cpp	2011-10-16 18:07:26 UTC (rev 341)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2010 by Daniel Calviño Sánchez                          *
+ *   Copyright (C) 2010-2011 by Daniel Calviño Sánchez                     *
  *   dan...@gm...                                                    *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -95,7 +95,11 @@
 
     manager->highlight(child);
 
-    WidgetHighlighter* childHighlighter = highlighterOf(child);
+    //If a normal pointer is used it can happen that the old highligther object
+    //is deleted and the new one is created at the same memory address, thus
+    //causing the assert to fail (even if the behavior was right). Using a
+    //QPointer prevents this, as it is set to 0 when its object is deleted.
+    QPointer<WidgetHighlighter> childHighlighter = highlighterOf(child);
 
     manager->highlight(&widget);
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |