summaryrefslogtreecommitdiff
path: root/debian/patches/01-fix-search-works-print-crash.patch
blob: cedafc198659b765d93331f3588e8cd723d652d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Upstream git commit https://gitorious.org/bibletime/bibletime/commit/f22df940f92da55445c36e1334ab542addf690ff
2011-05-15 Gary Holmlund <gary.holmlund@gmail.com>
 * Fix crash when printing from Works pane of search dialog.
Index: src/frontend/cexportmanager.cpp
===================================================================
--- a/src/frontend/cexportmanager.cpp	2011-06-19 21:35:46.000000000 -0700
+++ b/src/frontend/cexportmanager.cpp	2011-06-19 21:35:58.000000000 -0700
@@ -342,29 +342,27 @@
     CPrinter::KeyTreeItem::Settings settings;
     CPrinter::KeyTree tree;
 
-    QString startKey, stopKey;
     setProgressRange(list.Count());
-
-    list.setPosition(sword::TOP);
-    while (!list.Error() && !progressWasCancelled()) {
-        if (dynamic_cast<const sword::VerseKey&>(l) != 0) {
-            const sword::VerseKey &vk = static_cast<const sword::VerseKey&>(l);
-            startKey = QString::fromUtf8((const char*) vk.LowerBound());
-            stopKey = QString::fromUtf8((const char*) vk.UpperBound());
+    for (int i=0; i< list.Count(); i++) {
+        const sword::SWKey* swKey = list.getElement(i);
+        const sword::VerseKey* vKey = dynamic_cast<const sword::VerseKey*>(swKey);
+        if (vKey != 0) {
+            QString startKey = vKey->getText();
             tree.append(new CTextRendering::KeyTreeItem(startKey,
-                                                        stopKey,
-                                                        module,
-                                                        settings));
+                startKey,
+                module,
+                settings));
         }
         else {
-            startKey = QString::fromUtf8((const char*) * list);
-            tree.append(new CTextRendering::KeyTreeItem(startKey,
-                                                        module,
-                                                        settings));
+            QString key = swKey->getText();
+            tree.append(new CTextRendering::KeyTreeItem(key,
+                key,
+                module,
+                settings));
         }
-
-        list.increment();
         incProgress();
+        if (progressWasCancelled())
+            break;
     }
 
     QSharedPointer<CPrinter> printer(new CPrinter(0, displayOptions, filterOptions));