simpler-tiles 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/simpler_tiles/layer.c +3 -5
- data/ext/simpler_tiles/map.c +2 -1
- data/ext/simpler_tiles/query.c +2 -1
- data/ext/simpler_tiles/style.c +1 -4
- data/lib/simpler_tiles/version.rb +1 -1
- data/test/test_simpler_tiles.rb +32 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b61f77954101ab8a753016497e1add4289eda62
|
4
|
+
data.tar.gz: de284f7de5e1a8508003946f42d98e6df6a2ca8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1cd8686e83a43ea74d0fd2de2167b99f646296fb63d15a932a389cff36c13c02fbfaa7cec581ed9747ebdd2f8620a0032fc27a9bcfef285e1ac02d61c2a52b8
|
7
|
+
data.tar.gz: 7dcdfec476b4ffbf3459c685f6b8afd9951491b7a13362268fe8abe1eed7eb935982c2582876dfd8e8b298b93683e287dea313a11a8e94e3a0dd753faf4e7abb
|
data/ext/simpler_tiles/layer.c
CHANGED
@@ -22,10 +22,7 @@ mark_layer(void *layer){
|
|
22
22
|
static void
|
23
23
|
layer_free(void *layer){
|
24
24
|
simplet_layer_t *lyr = layer;
|
25
|
-
|
26
|
-
VALUE refs = (VALUE)simplet_layer_get_user_data(lyr);
|
27
|
-
// if not it is safe to free this layer.
|
28
|
-
if(!refs) simplet_layer_free(lyr);
|
25
|
+
simplet_layer_free(lyr);
|
29
26
|
}
|
30
27
|
|
31
28
|
|
@@ -68,8 +65,9 @@ add_query(VALUE self, VALUE query){
|
|
68
65
|
simplet_query_t *qry;
|
69
66
|
Data_Get_Struct(query, simplet_query_t, qry);
|
70
67
|
simplet_layer_add_query_directly(layer, qry);
|
71
|
-
VALUE circ_ref =
|
68
|
+
VALUE circ_ref = self;
|
72
69
|
simplet_query_set_user_data(qry, (void *)circ_ref);
|
70
|
+
simplet_retain((simplet_retainable_t*) qry);
|
73
71
|
return query;
|
74
72
|
}
|
75
73
|
|
data/ext/simpler_tiles/map.c
CHANGED
@@ -222,8 +222,9 @@ add_layer(VALUE self, VALUE layer){
|
|
222
222
|
simplet_layer_t *lyr;
|
223
223
|
Data_Get_Struct(layer, simplet_layer_t, lyr);
|
224
224
|
simplet_map_add_layer_directly(map, lyr);
|
225
|
-
VALUE circ_ref =
|
225
|
+
VALUE circ_ref = self;
|
226
226
|
simplet_layer_set_user_data(lyr, (void *)circ_ref);
|
227
|
+
simplet_retain((simplet_retainable_t*) lyr);
|
227
228
|
return layer;
|
228
229
|
}
|
229
230
|
|
data/ext/simpler_tiles/query.c
CHANGED
@@ -60,8 +60,9 @@ add_style(VALUE self, VALUE style){
|
|
60
60
|
simplet_style_t *style_s;
|
61
61
|
Data_Get_Struct(style, simplet_style_t, style_s);
|
62
62
|
simplet_query_add_style_directly(query, style_s);
|
63
|
-
VALUE circ_ref =
|
63
|
+
VALUE circ_ref = self;
|
64
64
|
simplet_style_set_user_data(style_s, (void *)circ_ref);
|
65
|
+
simplet_retain((simplet_retainable_t*) style_s);
|
65
66
|
return style;
|
66
67
|
}
|
67
68
|
|
data/ext/simpler_tiles/style.c
CHANGED
@@ -21,10 +21,7 @@ mark_style(void *style){
|
|
21
21
|
static void
|
22
22
|
style_free(void *style){
|
23
23
|
simplet_style_t *stl = style;
|
24
|
-
|
25
|
-
VALUE refs = (VALUE)simplet_style_get_user_data(stl);
|
26
|
-
// if not it is safe to free this style.
|
27
|
-
if(!refs) simplet_style_free(stl);
|
24
|
+
simplet_style_free(stl);
|
28
25
|
}
|
29
26
|
|
30
27
|
static VALUE
|
data/test/test_simpler_tiles.rb
CHANGED
@@ -23,4 +23,36 @@ class TestSimplerTiles < Test::Unit::TestCase
|
|
23
23
|
assert data.length
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
|
28
|
+
should "not crash with memory errors" do
|
29
|
+
GC.disable
|
30
|
+
t = 100.times.map do
|
31
|
+
Thread.new do
|
32
|
+
map = SimplerTiles::Map.new do |m|
|
33
|
+
m.slippy 3, 6, 4
|
34
|
+
m.layer "#{File.dirname(__FILE__)}/../data/tl_2010_us_state10.shp" do |l|
|
35
|
+
l.query "SELECT * from 'tl_2010_us_state10'" do |q|
|
36
|
+
q.styles 'fill' => "#061F3799",
|
37
|
+
'line-join' => "round",
|
38
|
+
'line-cap' => "square",
|
39
|
+
'seamless' => "true"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
assert map.valid?
|
45
|
+
map.to_png do |data|
|
46
|
+
assert data
|
47
|
+
File.open "#{File.dirname(__FILE__)}/out.png", "wb" do |f|
|
48
|
+
f.write data
|
49
|
+
end
|
50
|
+
assert data.length
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
t.map(&:join)
|
55
|
+
end
|
56
|
+
GC.enable
|
57
|
+
GC.start
|
26
58
|
end
|