Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault in file_finder.cpp #3581

Merged
merged 7 commits into from
Oct 12, 2013

Conversation

phaethonfire
Copy link
Contributor

At rutime, I was getting a segfault. A backtrace showed this:

(gdb) backtrace
#0 0x00007fff8a736162 in closedir ()
#1 0x00000001001a8b5a in file_finder::get_files_from_path (extension=@0x7fff5fbfa4f8, root_path=@0x7fff5fbfa4f0, recursive_search=true) at file_finder.cpp:73
#2 0x000000010084182c in get_tileset_names (dir_path=@0x7fff5fbfb738) at options.cpp:851
#3 0x00000001008447ef in initOptions () at options.cpp:315
#4 0x00000001004b38cb in main (argc=0, argv=0x7fff5fbff978) at main.cpp:66

stepping through showed this:

68 subdir = opendir(subpath.c_str());
(gdb)
69 if (subdir)
(gdb)
73 closedir(subdir);
(gdb)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff8a736162 in closedir ()

(gdb) p subdir
$1 = (DIR *) 0x0

Moving the closedir command inside the brackets fixes the error.

@phaethonfire
Copy link
Contributor Author

Kind of weird that github is showing all my old commits... I may have done things out of order in branching and merging. 7 commits for one line change... lol.

@GalenEvil GalenEvil merged commit f378698 into CleverRaven:master Oct 12, 2013
@GalenEvil
Copy link
Contributor

did not notice that o.O Doesn't seem to be changing any more than that one line though so it should be safe

@phaethonfire phaethonfire deleted the fix-file-finder branch October 14, 2013 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants