N0NB / xdx

XDX DX Cluster client (originally by Joop Stakenborg, PG4I)
GNU General Public License v2.0
10 stars 7 forks source link

Segfault if cty.dat cannot be found/loaded #5

Open jpronans opened 9 years ago

jpronans commented 9 years ago

Program received signal SIGSEGV, Segmentation fault. lookupcountry_by_callsign (callsign=) at text.c:1035 1035 dxcc_data *d = g_ptr_array_index(dxcc, lookup.country);

N0NB commented 9 years ago

Hi John.

I'll look into this. How did all copies of cty.dat get removed? There should be at least a fallback copy installed by 'make install' and if a copy is found in ~/.xdx then it will be used.

I agree that a segfault is a poor way to handle this so the program should exit gracefully.

73, Nate

jpronans commented 9 years ago

I don't remember, but I believe I hadn't done a 'make install', and ran it in its main directory... I know it isn't a biggie, just thought you should know. Tbh, I had meant to get back to you with a patch, but completely forgot about it until now.

N0NB commented 9 years ago

Thanks, John.

That will be helpful in replicating the issue and chasing it down.

73, Nate

"The optimist proclaims that we live in the best of all possible worlds. The pessimist fears this is true."

Ham radio, Linux, bikes, and more: http://www.n0nb.us

N0NB commented 9 years ago

I just tried running it from the src directory with no cty.dat in the installation directory or in ~/.xdx and finally saw the segmentation fault (likely due to the filters I have set on the DX Cluster I use) as follows:

 $ ./xdx 

** (xdx:22916): WARNING **: Error loading icon: Failed to open file '/usr/local/share/xdx/pixmaps/xdx.png': No such file or directory
No such file or directory: /home/nate/.xdx/cty.dat
Cannot read cty.dat in /usr/local/share/xdx/cty.dat

(xdx:22916): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(xdx:22916): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(xdx:22916): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(xdx:22916): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(xdx:22916): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(xdx:22916): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
Segmentation fault

This is from a fresh build of the master branch (there is no difference right now between master and the xdx-2.5.0 branch except for the version string in configure.ac which shows up in the About dialog).

I will probably release 2.5 before this gets fixed. At least I'm aware of it and it should be a rare issue.

73, Nate