Failure to folder::open() with non-alphanumeric names
When trying to do folder::open() on a GMail folder with a path of a single component [Gmail], firstly a command_error exception is thrown, then during stack unwinding and destruction of another object another exception is thrown (I've removed the irrelevant top of the trace from my own app):
(gdb) catch throw
...
Catchpoint 1 (exception thrown), 0x00007ffff3f2f320 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/libstdc++.so.6
(gdb) bt
#0 0x00007ffff3f2f320 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/libstdc++.so.6
#1 0x00007fffba4a65e7 in vmime::net::imap::IMAPFolder::open (this=0x7fff8c210670, mode=0, failIfModeIsNotAvailable=false) at /home/d34df00d/Programming/readonly/vmime/src/vmime/net/imap/IMAPFolder.cpp:179
#2 0x00007fffd85933a3 in LeechCraft::Snails::AccountThreadWorker::GetFolder (this=<optimized out>, path=..., mode=0) at /home/d34df00d/Programming/leechcraft/src/plugins/snails/accountthreadworker.cpp:257
...
(gdb) cont
Continuing.
Catchpoint 1 (exception thrown), 0x00007ffff3f2f320 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/libstdc++.so.6
(gdb) bt
#0 0x00007ffff3f2f320 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/libstdc++.so.6
#1 0x00007fffba40518d in boost::throw_exception<boost::bad_weak_ptr> (e=...) at /usr/include/boost/throw_exception.hpp:70
#2 0x00007fffba404c91 in boost::detail::shared_count::shared_count (this=0x7fffb1a0b4d8, r=...) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:580
#3 0x00007fffba405871 in boost::shared_ptr<vmime::object>::shared_ptr<vmime::object> (this=0x7fffb1a0b4d0, r=...) at /usr/include/boost/smart_ptr/shared_ptr.hpp:404
#4 0x00007fffba405443 in boost::enable_shared_from_this<vmime::object>::shared_from_this (this=0x7fff8c2100a8) at /usr/include/boost/smart_ptr/enable_shared_from_this.hpp:49
#5 0x00007fffba46abf5 in vmime::net::imap::IMAPConnection::internalDisconnect (this=0x7fff8c2100a0) at /home/d34df00d/Programming/readonly/vmime/src/vmime/net/imap/IMAPConnection.cpp:700
#6 0x00007fffba46ab75 in vmime::net::imap::IMAPConnection::disconnect (this=0x7fff8c2100a0) at /home/d34df00d/Programming/readonly/vmime/src/vmime/net/imap/IMAPConnection.cpp:692
#7 0x00007fffba467f3b in vmime::net::imap::IMAPConnection::~IMAPConnection (this=0x7fff8c2100a0, __in_chrg=<optimized out>) at /home/d34df00d/Programming/readonly/vmime/src/vmime/net/imap/IMAPConnection.cpp:92
#8 0x00007fffba4b8046 in boost::detail::sp_ms_deleter<vmime::net::imap::IMAPConnection>::destroy (this=0x7fff8c210098) at /usr/include/boost/smart_ptr/make_shared_object.hpp:57
#9 0x00007fffba4b8b28 in boost::detail::sp_ms_deleter<vmime::net::imap::IMAPConnection>::operator() (this=0x7fff8c210098) at /usr/include/boost/smart_ptr/make_shared_object.hpp:87
#10 0x00007fffba4b89f1 in boost::detail::sp_counted_impl_pd<vmime::net::imap::IMAPConnection*, boost::detail::sp_ms_deleter<vmime::net::imap::IMAPConnection> >::dispose (this=0x7fff8c210080) at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:153
#11 0x00007fffba338f58 in boost::detail::sp_counted_base::release (this=0x7fff8c210080) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
#12 0x00007fffba33901b in boost::detail::shared_count::~shared_count (this=0x7fffb1a0b6e8, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:371
#13 0x00007fffba48d392 in boost::shared_ptr<vmime::net::imap::IMAPConnection>::~shared_ptr (this=0x7fffb1a0b6e0, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/shared_ptr.hpp:328
#14 0x00007fffba4a6d5e in vmime::net::imap::IMAPFolder::open (this=0x7fff8c210670, mode=0, failIfModeIsNotAvailable=false) at /home/d34df00d/Programming/readonly/vmime/src/vmime/net/imap/IMAPFolder.cpp:266
...
(gdb) cont
Continuing.
[Thread 0x7fffd9ffb700 (LWP 28692) exited]
[Thread 0x7fffd97fa700 (LWP 28693) exited]
[Thread 0x7fffda7fc700 (LWP 28691) exited]
[Thread 0x7fffbb7fe700 (LWP 28697) exited]
[Thread 0x7fffbaffd700 (LWP 28698) exited]
[Thread 0x7fffb37fe700 (LWP 28696) exited]
[Thread 0x7fffbbfff700 (LWP 28695) exited]
[Thread 0x7fffe0dfa700 (LWP 28687) exited]
[Thread 0x7fffd8ff9700 (LWP 28694) exited]
[Thread 0x7fffdb7fe700 (LWP 28689) exited]
[Thread 0x7fffdbfff700 (LWP 28688) exited]
[Thread 0x7fffdaffd700 (LWP 28690) exited]
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_weak_ptr> >'
what(): tr1::bad_weak_ptr
resp->getErrorLog() contains the following at the original point of failure causing the exception:
"a003 NO [NONEXISTENT] Unknown Mailbox: [Gmail] (Failure)"
vmime HEAD.
The title may be misleading a bit as the dashes, for example, don't cause this.
Ok, seems like [Gmail] isn't a true folder after all: https://productforums.google.com/forum/#!topic/gmail/HCYivYeO5VU
Anyway, I guess vmime shouldn't make stuff throwing yet one more exception during stack unwinding causing calling std::terminate() even in this case :)
Also, it'd be great if vmime autodetected the NONEXISTENT kind of errors and threw a special exception in this case, so it would have been easier to account for this in the user code.
Thanks.