mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 11:27:29 +00:00
base: free memory of object throwing exception
in constructor. Extend test case to verify it and run it by autopilot.
This commit is contained in:
parent
7f78d182f8
commit
33b40ec5d9
@ -249,6 +249,19 @@ void operator delete (void *, Genode::Deallocator *);
|
||||
void operator delete (void *, Genode::Deallocator &);
|
||||
|
||||
|
||||
/**
|
||||
* The compiler looks for a delete operator signature matching the one of the
|
||||
* new operator. If none is found, it omits (silently!) the generation of
|
||||
* implicitly delete calls, which are needed when an exception is thrown within
|
||||
* the constructor of the object.
|
||||
*/
|
||||
inline void operator delete (void *ptr, Genode::Allocator *a) {
|
||||
operator delete (ptr, static_cast<Genode::Deallocator *>(a)); }
|
||||
|
||||
inline void operator delete (void *ptr, Genode::Allocator &a) {
|
||||
operator delete (ptr, *static_cast<Genode::Deallocator *>(&a)); }
|
||||
|
||||
|
||||
/**
|
||||
* Destroy object
|
||||
*
|
||||
|
@ -49,6 +49,7 @@ compare_output_to {
|
||||
[init -> test-new_delete] ~B
|
||||
[init -> test-new_delete] ~C
|
||||
[init -> test-new_delete] ~A
|
||||
[init -> test-new_delete] Allocator::free()
|
||||
[init -> test-new_delete] exception caught
|
||||
[init -> test-new_delete] Allocator::alloc()
|
||||
[init -> test-new_delete] A
|
||||
@ -73,6 +74,7 @@ compare_output_to {
|
||||
[init -> test-new_delete] ~B
|
||||
[init -> test-new_delete] ~C
|
||||
[init -> test-new_delete] ~A
|
||||
[init -> test-new_delete] Allocator::free()
|
||||
[init -> test-new_delete] exception caught
|
||||
}
|
||||
|
||||
|
@ -74,3 +74,4 @@ cpu_sampler
|
||||
cpu_sampler_noux
|
||||
usb_hid
|
||||
smartcard
|
||||
new_delete
|
||||
|
Loading…
x
Reference in New Issue
Block a user