283 allocFailer.deactivate(); |
284 allocFailer.deactivate(); |
284 (*testMessageHandler)(type, msg); |
285 (*testMessageHandler)(type, msg); |
285 allocFailer.reactivateAt(currentIndex); |
286 allocFailer.reactivateAt(currentIndex); |
286 } |
287 } |
287 |
288 |
|
289 typedef void (*PVF)(); |
|
290 PVF defaultTerminate; |
|
291 void debugTerminate() |
|
292 { |
|
293 // you can detect uncaught exceptions with a breakpoint in here |
|
294 (*defaultTerminate)(); |
|
295 } |
|
296 |
|
297 PVF defaultUnexpected; |
|
298 void debugUnexpected() |
|
299 { |
|
300 // you can detect unexpected exceptions with a breakpoint in here |
|
301 (*defaultUnexpected)(); |
|
302 } |
|
303 |
288 void tst_ExceptionSafetyObjects::initTestCase() |
304 void tst_ExceptionSafetyObjects::initTestCase() |
289 { |
305 { |
|
306 // set handlers for bad exception cases, you might want to step in and breakpoint the default handlers too |
|
307 defaultTerminate = std::set_terminate(&debugTerminate); |
|
308 defaultUnexpected = std::set_unexpected(&debugUnexpected); |
290 testMessageHandler = qInstallMsgHandler(safeMessageHandler); |
309 testMessageHandler = qInstallMsgHandler(safeMessageHandler); |
291 |
310 |
292 QVERIFY(AllocFailer::initialize()); |
311 QVERIFY(AllocFailer::initialize()); |
293 |
312 |
294 // sanity check whether OOM simulation works |
313 // sanity check whether OOM simulation works |