SF Bugs#126: Fix crash in gdk_rgb_convert_0888 due to using deallocated memory.
There is reference counter in cached pixel buffers.
Previously it always equalled one although multiple tasks could be using it.
Thus when the cache is flushed, memory was always deallocated but then another task would attempt to use it and crash.
Thus now the cached pixel buffer is tracked properly with unref() after being used,
so only when reference count is zero it is automatically deallocated.
Rob Norris [Fri, 25 Sep 2015 19:29:15 +0000 (20:29 +0100)]
Disable Search and Routing with Google as they no longer support the APIs Viking used.
The only supported file formats seem to be JSON and XML in their own custom schemas (and not currently supported by GPSBabel).
Also now you need to supply an application key for all Google APIs.
Previously, in order to build the reference documentation only when needed
(read: only some maintainers and only when they want) a solution was created
to deactivate processing of the whole doc subtree. But the side effect was to
not deliver at all the doc subtree if the correct options are not activated.
With an incomplete delivery, some tools like autoreconf (used by packaging
utilities) fail, bringing packager to patch and patch again the sources.
With this change, the doc subtree is no more ignored and the reference
documentation is processed ony when the corresponding ./configure flags is
activated.
Insert parameter for Viking's version in viking.xml
Insertion is done by configure, so the file is renamed as viking.xml.in.
The most annoying with this change is probably to configure the XML editor
to handle xml.in files.
Roman Lebedev [Fri, 28 Aug 2015 15:19:16 +0000 (18:19 +0300)]
Fix heap-buffer-overflow on Layers -> New GPS Layer
Very typical issue, unfortunately, missing braces and we are
corrupting memory. It is better to use g_malloc_n() to avoid this.
Fixes following AddressSanitizer error:
==17766==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60b0008db6a0 at pc 0x00000048ba9e bp 0x7ffcf3e532a0 sp 0x7ffcf3e53298
WRITE of size 8 at 0x60b0008db6a0 thread T0
0 0x48ba9d in gps_layer_inst_init /home/lebedevri/src/viking/src/vikgpslayer.c:386
1 0x7fa95d549f98 in g_type_create_instance (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x31f98)
2 0x7fa95d52d866 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x15866)
3 0x7fa95d52f25c in g_object_newv (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1725c)
4 0x7fa95d52f9f3 in g_object_new (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x179f3)
5 0x48dca7 in vik_gps_layer_new /home/lebedevri/src/viking/src/vikgpslayer.c:659
6 0x48e1f0 in vik_gps_layer_create /home/lebedevri/src/viking/src/vikgpslayer.c:419
7 0x45d119 in vik_layer_create /home/lebedevri/src/viking/src/viklayer.c:229
8 0x460463 in vik_layers_panel_new_layer /home/lebedevri/src/viking/src/viklayerspanel.c:461
9 0x46982e in menu_addlayer_cb /home/lebedevri/src/viking/src/vikwindow.c:2411
10 0x7fa95d5282d4 in g_closure_invoke (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x102d4)
11 0x7fa95d53a03b (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2203b)
12 0x7fa95d542697 in g_signal_emit_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2a697)
13 0x7fa95d5428fe in g_signal_emit (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2a8fe)
14 0x7fa95f0ec8cf (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x748cf)
15 0x7fa95d528503 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x10503)
16 0x7fa95d541fa6 in g_signal_emit_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x29fa6)
17 0x7fa95d5428fe in g_signal_emit (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2a8fe)
18 0x7fa95f2c0c55 in gtk_widget_activate (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x248c55)
19 0x7fa95f1bc98c in gtk_menu_shell_activate_item (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x14498c)
20 0x7fa95f1bcd2a (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x144d2a)
21 0x7fa95f1aaa7e (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x132a7e)
22 0x7fa95d5282d4 in g_closure_invoke (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x102d4)
23 0x7fa95d539f31 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x21f31)
24 0x7fa95d5421a4 in g_signal_emit_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2a1a4)
25 0x7fa95d5428fe in g_signal_emit (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2a8fe)
26 0x7fa95f2c1ecb (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x249ecb)
27 0x7fa95f1a91c3 in gtk_propagate_event (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x1311c3)
28 0x7fa95f1a965a in gtk_main_do_event (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x13165a)
29 0x7fa95ee1abbb (/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0+0x5abbb)
30 0x7fa95d251c3c in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49c3c)
31 0x7fa95d251f1f (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49f1f)
32 0x7fa95d252241 in g_main_loop_run (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a241)
33 0x7fa95f1a85d6 in gtk_main (/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0+0x1305d6)
34 0x41829c in main /home/lebedevri/src/viking/src/main.c:259
35 0x7fa959a69b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
36 0x417b78 (/home/lebedevri/src/viking/src/viking+0x417b78)
0x60b0008db6a1 is located 0 bytes to the right of 97-byte region [0x60b0008db640,0x60b0008db6a1)
allocated by thread T0 here:
0 0x7fa95f96437a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9437a)
1 0x7fa95d257799 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f799)
2 0x7fa95d549f98 in g_type_create_instance (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x31f98)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lebedevri/src/viking/src/vikgpslayer.c:386 gps_layer_inst_init
Shadow bytes around the buggy address:
..
0x0c16801136c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
=>0x0c16801136d0: 00 00 00 00[01]fa fa fa fa fa fa fa fa fa 00 00
..
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
==17766==ABORTING
Szymon Bigos [Mon, 31 Aug 2015 21:39:17 +0000 (22:39 +0100)]
SF Bugs#121: Fix crash when invalidating previously acquired tiles.
This race condition can most often be triggered by zooming in/out rapidly.
The fault is due to using accessing variables outside of the lock section of the memory cache.
This has been in the code since the initial lock adding commit [in 2008]
(SHA:9b79169dba7cd4df6badebdda23a370064ebfafd)
Rob Norris [Tue, 28 Jul 2015 23:52:09 +0000 (00:52 +0100)]
SF BugsZZ#123: Fix bzip2 decompression on Windows.
Need to specify opening as a binary file otherwise BZ2 read fails on Windows.
Also remember to cleanup resources - particularly closing the file.
Otherwise on Windows the subsequent remove + rename file operations fail as the file is still open.
Rob Norris [Mon, 18 May 2015 22:45:24 +0000 (23:45 +0100)]
Don't retain GTK Dialogs in memory.
Not entirely sure why these were created and then shown/hidden as it doesn't save much time compared to simply creating them on demand.
Latest versions of GTK Dialog are more complicated and seemingly respawns a thread every few seconds (presumably to monitor if files have been created/deleted), irrespective whether the dialog is shown or not.
Thus now destroying it we avoid this unnecessary thread (re)creation overhead.
Rob Norris [Sat, 2 May 2015 10:51:45 +0000 (11:51 +0100)]
Red Hat Bugzilla – Bug 1210403: Only download and process one Bing attribution list.
If making more than one download request to get the Bing attributions,
but then updating (and using) a single instance variable from multiple threads,
results in undefined behaviour (i.e. could lead to crashes).
Rob Norris [Sun, 29 Mar 2015 22:47:45 +0000 (23:47 +0100)]
Fix potential broken builds.
Annoyingly g_str_to_ascii() is actually a recent addition to GLIB,
despite the manual not stating which version it is available in
(hence I thought it was always available).