[poppler] Branch 'poppler-0.22' - qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Apr 7 08:43:58 PDT 2013


 qt4/src/poppler-link.h   |    6 +++---
 qt4/src/poppler-media.cc |    6 ++++++
 qt4/src/poppler-media.h  |    5 ++++-
 qt4/src/poppler-page.cc  |    4 ++--
 4 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit e6559a0d836df127ed5061794dc737d435ef534c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 7 17:42:23 2013 +0200

    Fix crash in KDE bug #317710
    
    It is not guaranteed that the ::LinkAction passed to PageData::convertLinkActionToLink
    will be always around (e.g. Page::action deletes it) so make a copy of the ::MediaRendition object

diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h
index ef93bf0..2c4bb55 100644
--- a/qt4/src/poppler-link.h
+++ b/qt4/src/poppler-link.h
@@ -1,5 +1,5 @@
 /* poppler-link.h: qt interface to poppler
- * Copyright (C) 2006, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2006, 2013, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2007-2008, 2010, Pino Toscano <pino at kde.org>
  * Copyright (C) 2010, 2012, Guillermo Amaral <gamaral at kdab.com>
  * Copyright (C) 2012, Tobias Koenig <tokoe at kdab.com>
@@ -471,7 +471,7 @@ class POPPLER_QT4_EXPORT LinkRendition : public Link
 		 * Create a new rendition link.
 		 *
 		 * \param linkArea the active area of the link
-		 * \param rendition the media rendition object
+		 * \param rendition the media rendition object. Ownership is taken
 		 *
 		 * \deprecated Use the constructor that takes all parameter instead
 		 */
@@ -481,7 +481,7 @@ class POPPLER_QT4_EXPORT LinkRendition : public Link
 		 * Create a new rendition link.
 		 *
 		 * \param linkArea the active area of the link
-		 * \param rendition the media rendition object
+		 * \param rendition the media rendition object. Ownership is taken
 		 * \param operation the numeric operation (action) (@see ::LinkRendition::RenditionOperation)
 		 * \param script the java script code
 		 * \param annotationReference the object reference of the screen annotation associated with this rendition action
diff --git a/qt4/src/poppler-media.cc b/qt4/src/poppler-media.cc
index c318147..1757fdb 100644
--- a/qt4/src/poppler-media.cc
+++ b/qt4/src/poppler-media.cc
@@ -1,5 +1,6 @@
 /* poppler-media.cc: qt interface to poppler
  * Copyright (C) 2012 Guillermo A. Amaral B. <gamaral at kde.org>
+ * Copyright (C) 2013 Albert Astals Cid <aacid at kde.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,6 +38,11 @@ public:
   : rendition(rendition)
   {
   }
+  
+  ~MediaRenditionPrivate()
+  {
+    delete rendition;
+  }
 
   ::MediaRendition *rendition;
 };
diff --git a/qt4/src/poppler-media.h b/qt4/src/poppler-media.h
index 64ec83c..34e5c36 100644
--- a/qt4/src/poppler-media.h
+++ b/qt4/src/poppler-media.h
@@ -1,6 +1,6 @@
 /* poppler-media.h: qt interface to poppler
  * Copyright (C) 2012 Guillermo A. Amaral B. <gamaral at kde.org>
- * Copyright (C) 2012 Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2012, 2013 Albert Astals Cid <aacid at kde.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,6 +39,9 @@ namespace Poppler
    */
   class POPPLER_QT4_EXPORT MediaRendition {
    public:
+    /**
+      Constructs a MediaRendition. Takes ownership of the passed rendition
+     */
     MediaRendition(::MediaRendition *rendition);
     ~MediaRendition();
 
diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index 5475614..c6d56ed 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -1,7 +1,7 @@
 /* poppler-page.cc: qt interface to poppler
  * Copyright (C) 2005, Net Integration Technologies, Inc.
  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
- * Copyright (C) 2005-2012, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005-2013, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus at math.uni-koeln.de>
  * Copyright (C) 2006-2011, Pino Toscano <pino at kde.org>
  * Copyright (C) 2008 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -204,7 +204,7 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo
       if ( lrn->hasScreenAnnot() )
         reference = lrn->getScreenAnnot();
 
-      popplerLink = new LinkRendition( linkArea, lrn->getMedia(), lrn->getOperation(), UnicodeParsedString( lrn->getScript() ), reference );
+      popplerLink = new LinkRendition( linkArea, lrn->getMedia()->copy(), lrn->getOperation(), UnicodeParsedString( lrn->getScript() ), reference );
     }
     break;
 


More information about the poppler mailing list