On sábado, 27 de julho de 2013 15:09:24, Alexander Syvak wrote: > > Do not use QtGui again. If an > > exception unwound the stack in QtGui, then QtGui is now in an undefined > > state, > > which means your application could do worse things than crash. > > How would you then handle std::bad_alloc in case there're a new widget made > during an event clicked()?
You wouldn't. That situation does not happen under ordinary circumstances. If std::bad_alloc is thrown, it's most often because you passed some silly value to operator new() or passed some invalid data somewhere -- like decoding a corrupt QDataStream, which has an absurd size for a QString. Under legitimate memory allocation conditions, getting std::bad_alloc is extremely rare. By the time that the system has so little memory left, it's been swapping for a while and the user is already annoyed. In fact, for the OS to refuse to allocate memory for you, it usually means its OOM killer has been triggered already. Not to mention that you may run out of memory and be killed for it with no notification. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest