{"action":"created","issue":{"url":"https://api.github.com/repos/tfussell/xlnt/issues/72","repository_url":"https://api.github.com/repos/tfussell/xlnt","labels_url":"https://api.github.com/repos/tfussell/xlnt/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/tfussell/xlnt/issues/72/comments","events_url":"https://api.github.com/repos/tfussell/xlnt/issues/72/events","html_url":"https://github.com/tfussell/xlnt/issues/72","id":184697806,"number":72,"title":"Sample error ","user":{"login":"sukoi26","id":23014567,"avatar_url":"https://avatars.githubusercontent.com/u/23014567?v=3","gravatar_id":"","url":"https://api.github.com/users/sukoi26","html_url":"https://github.com/sukoi26","followers_url":"https://api.github.com/users/sukoi26/followers","following_url":"https://api.github.com/users/sukoi26/following{/other_user}","gists_url":"https://api.github.com/users/sukoi26/gists{/gist_id}","starred_url":"https://api.github.com/users/sukoi26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sukoi26/subscriptions","organizations_url":"https://api.github.com/users/sukoi26/orgs","repos_url":"https://api.github.com/users/sukoi26/repos","events_url":"https://api.github.com/users/sukoi26/events{/privacy}","received_events_url":"https://api.github.com/users/sukoi26/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-23T15:53:27Z","updated_at":"2016-10-26T00:14:28Z","closed_at":null,"body":"Hello, \r\nAfter compiling the library  under Linux, with no errors, i try the sample :\r\n`~/dvp/xlnt/samples$ g++ -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt sample.cpp -o sample` \r\n\r\nI received this error:\r\n\r\n> \r\n\r\nGNU gdb (Debian 7.11.1-2) 7.11.1\r\nReading symbols from ./sample...done.\r\n(gdb) r\r\nStarting program: ~/dvp/xlnt/samples/sample \r\nterminate called after throwing an instance of 'std::out_of_range'\r\n  what():  _Map_base::at\r\n\r\nProgram received signal SIGABRT, Aborted.\r\n0x00007ffff6960fdf in raise () from /lib/x86_64-linux-gnu/libc.so.6\r\n(gdb) bt\r\n\r\n0  0x00007ffff6960fdf in raise () from /lib/x86_64-linux-gnu/libc.so.6\r\n#1  0x00007ffff696240a in abort () from /lib/x86_64-linux-gnu/libc.so.6\r\n#2  0x00007ffff727804d in __gnu_cxx::__verbose_terminate_handler() ()\r\n   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6\r\n#3  0x00007ffff7276016 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6\r\n#4  0x00007ffff7276061 in std::terminate() ()\r\n   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6\r\n#5  0x00007ffff7276279 in __cxa_throw ()\r\n   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6\r\n#6  0x00007ffff729e50f in std::__throw_out_of_range(char const*) ()\r\n   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6\r\n#7  0x00007ffff789f843 in std::__detail::_Map_base<xlnt::column_t, std::pair<xlnt::column_t const, xlnt::detail::cell_impl>, std::allocator<std::pair<xlnt::column_t const, xlnt::detail::cell_impl> >, std::__detail::_Select1st, std::equal_to<xlnt::column_t>, std::hash<xlnt::column_t>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, true>::at(xlnt::column_t const&)\r\n    () from /usr/local/lib/libxlnt.so.0.9\r\n#8  0x00007ffff789d3a3 in std::unordered_map<xlnt::column_t, xlnt::detail::cell_impl, std::hash<xlnt::column_t>, std::equal_to<xlnt::column_t>, std::allocator<std::pair<xlnt::column_t const, xlnt::detail::cell_impl> > >::at(xlnt::column_t const&) () from /usr/local/lib/libxlnt.so.0.9\r\n#9  0x00007ffff7894515 in xlnt::worksheet::get_cell(xlnt::cell_reference const&)`\r\n` const () from /usr/local/lib/libxlnt.so.0.9\r\n#10 0x00007ffff7889d7b in xlnt::const_cell_iterator::operator*() const ()\r\n   from /usr/local/lib/libxlnt.so.0.9\r\n#11 0x00007ffff7938268 in xlnt::detail::xlsx_producer::write_shared_string_table(xlnt::relationship const&) () from /usr/local/lib/libxlnt.so.0.9\r\n#12 0x00007ffff7933c5a in xlnt::detail::xlsx_producer::write_workbook(xlnt::relationship const&) () from /usr/local/lib/libxlnt.so.0.9\r\n#13 0x00007ffff792544e in xlnt::detail::xlsx_producer::populate_archive() ()\r\n   from /usr/local/lib/libxlnt.so.0.9\r\n#14 0x00007ffff7924d24 in xlnt::detail::xlsx_producer::write(xlnt::path const&)\r\n    () from /usr/local/lib/libxlnt.so.0.9\r\n#15 0x00007ffff784e68e in xlnt::workbook::save(xlnt::path const&) const ()\r\n   from /usr/local/lib/libxlnt.so.0.9\r\n#16 0x00007ffff784e5a5 in xlnt::workbook::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const ()\r\n   from /usr/local/lib/libxlnt.so.0.9\r\n#17 0x00000000004010cd in main ()\r\n    at ~dvp/xlnt/samples/data/sample/main.cpp:12\r\n\r\n> \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tfussell/xlnt/issues/comments/256215424","html_url":"https://github.com/tfussell/xlnt/issues/72#issuecomment-256215424","issue_url":"https://api.github.com/repos/tfussell/xlnt/issues/72","id":256215424,"user":{"login":"tfussell","id":1735211,"avatar_url":"https://avatars.githubusercontent.com/u/1735211?v=3","gravatar_id":"","url":"https://api.github.com/users/tfussell","html_url":"https://github.com/tfussell","followers_url":"https://api.github.com/users/tfussell/followers","following_url":"https://api.github.com/users/tfussell/following{/other_user}","gists_url":"https://api.github.com/users/tfussell/gists{/gist_id}","starred_url":"https://api.github.com/users/tfussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfussell/subscriptions","organizations_url":"https://api.github.com/users/tfussell/orgs","repos_url":"https://api.github.com/users/tfussell/repos","events_url":"https://api.github.com/users/tfussell/events{/privacy}","received_events_url":"https://api.github.com/users/tfussell/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T00:14:27Z","updated_at":"2016-10-26T00:14:27Z","body":"There are a few separate issues here. As @yekm discovered (nice detective work!), iterating over the rows and columns in a workbook is sort of broken at the moment. This doesn't normally show up because iterating over a non-const workbook adds the cells to the internal cell map as it looks them up (see http://en.cppreference.com/w/cpp/container/unordered_map/operator_at). During writing, the workbook is const and the loop to count the number of strings to write to the shared string table was looking up non-existent cells. This particular problem during writing is fixed with commit b83cf64 and the code in the comment now works as expected. More work needs to be done to fix cell iteration.\r\n\r\nThe crash in sample.cpp mentioned by @sukoi26 was caused by bad XML writing/reading for the shared strings file. This is fixed with a commit I will make tonight. This commit will include significant improvements to the build system and supporting files. samples/sample.cpp will be updated and I will begin compiling samples in Travis/AppVeyor to ensure they are always in a working state. After \"git pull\", it will be necessary to \"git submodule init && git submodule update\" to get botan which is the new encryption library used for reading password-protected workbooks. Certain builds may fail during this commit but they will be resolved in short time."}}
{"actor":{"display_login":"tfussell"}}