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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
From c0d97536f9ac967941b6ca48a6a7a4dde44f4ee3 Mon Sep 17 00:00:00 2001
From: Garrett Potts <gpotts@radiantblue.com>
Date: Thu, 31 Oct 2019 07:42:32 -0400
Subject: [PATCH] Fixed a core dump
---
src/base/ossimPolyArea2d.cpp | 10 ++++---
src/init/ossimInit.cpp | 52 +++---------------------------------
2 files changed, 9 insertions(+), 53 deletions(-)
diff --git a/src/base/ossimPolyArea2d.cpp b/src/base/ossimPolyArea2d.cpp
index 572d59de..3212b74a 100644
--- a/src/base/ossimPolyArea2d.cpp
+++ b/src/base/ossimPolyArea2d.cpp
@@ -100,6 +100,7 @@ class ossimPolyArea2dPrivate
void ossimPolyArea2dPrivate::setGeometry(const ossimPolygon &exteriorRing,
const std::vector<ossimPolygon> &interiorRings)
{
+
deleteGeometry();
if (exteriorRing.getNumberOfVertices() < 1)
@@ -107,14 +108,15 @@ void ossimPolyArea2dPrivate::setGeometry(const ossimPolygon &exteriorRing,
GEOSGeometryPtr shell = 0;
std::vector<GEOSGeometryPtr> holes;
const std::vector<ossimDpt> &pts = exteriorRing.getVertexList();
- int idx = 0;
- int n = (int)pts.size();
+ ossim_int32 idx = 0;
+ ossim_int32 n = (int)pts.size();
bool firstAndLastSame = ((pts[0].x == pts[n - 1].x) && (pts[0].y == pts[n - 1].y));
if (n > 0)
{
GEOSCoordSequence *shellSeq = GEOSCoordSeq_create(
- exteriorRing.getNumberOfVertices() + ((firstAndLastSame) ? 0 : 1), 2);
+ n + ((firstAndLastSame) ? 0 : 1), 2);
+
//fill the exterior ring
for (idx = 0; idx < n; idx++)
{
@@ -123,7 +125,7 @@ void ossimPolyArea2dPrivate::setGeometry(const ossimPolygon &exteriorRing,
//if the original polygon didn't have the first and last point the same, make it so
if (!firstAndLastSame)
{
- GEOSCoordSeq_setXY(shellSeq, idx, pts[0].x, pts[0].y);
+ GEOSCoordSeq_setXY(shellSeq, n, pts[0].x, pts[0].y);
}
shell = GEOSGeom_createLinearRing(shellSeq);
//fill the interior rings
diff --git a/src/init/ossimInit.cpp b/src/init/ossimInit.cpp
index 2c2ec2c1..787a49d9 100644
--- a/src/init/ossimInit.cpp
+++ b/src/init/ossimInit.cpp
@@ -195,6 +195,8 @@ void ossimInit::initialize(ossimArgumentParser& parser)
}
return;
}
+ initGEOS(geosNoticeFunction, geosErrorFunction);
+
theInstance->parseEnvOptions(parser);
theInstance->parseNotifyOption(parser);
theInstance->parsePrefsOptions(parser);
@@ -253,7 +255,7 @@ void ossimInit::initialize()
}
return;
}
-
+
int argc = 1;
char* argv[1];
@@ -261,54 +263,6 @@ void ossimInit::initialize()
argv[0][0] = '\0';
initialize(argc, argv);
delete [] argv[0];
-
-#if 0
- static std::mutex m;
- std::lock_guard<std::mutex> lock(m);
- if(theInitializedFlag)
- {
- if (traceDebug())
- {
- ossimNotify(ossimNotifyLevel_DEBUG)
- << "DEBUG ossimInit::initialize(): Already initialized, returning......" << std::endl;
- }
- return;
- }
-
- theInstance->theAppName = "";
- theInstance->thePreferences = ossimPreferences::instance();
- theInstance->initializeDefaultFactories();
-
- if ( theElevEnabledFlag )
- {
- theInstance->initializeElevation();
- }
-
- theInstance->initializeLogFile();
-
- //---
- // To do:
- // We need a mechanism to register factories to the "front" or the
- // "back" of factory list so that plugins can override things. For
- // now we will initialize the plugins last...
- //---
- if(thePluginLoaderEnabledFlag)
- {
- theInstance->initializePlugins();
- }
-
- if (traceDebug())
- {
- ossimNotify(ossimNotifyLevel_DEBUG)
- << "ossim preferences file: "
- << theInstance->thePreferences->getPreferencesFilename()
- << "\nVersion: " << version()
- << "\nossimInit::initialize() leaving..."
- << std::endl;
- }
-
- theInitializedFlag = true;
-#endif
}
void ossimInit::finalize()
|