mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-11 05:12:05 +00:00
terminal: add Cell_array destructor
With the capability-quota mechanism, the terminal-session won't always be constructed completely on the first try (we may run out of caps in the middle of the construction). Therefore, all members of the object must be properly destructable. Furthermore, the patch replaces the sliced heap by a heap to avoid allocating a new dataspace for each line of the cell array.
This commit is contained in:
parent
a731131c09
commit
71efb59873
@ -284,9 +284,7 @@ namespace Terminal {
|
||||
|
||||
Flush_callback_registry &_flush_callback_registry;
|
||||
Trigger_flush_callback &_trigger_flush_callback;
|
||||
|
||||
Genode::Attached_ram_dataspace _io_buffer;
|
||||
|
||||
Framebuffer::Mode _fb_mode;
|
||||
Genode::Dataspace_capability _fb_ds_cap;
|
||||
unsigned _char_width;
|
||||
@ -489,15 +487,14 @@ namespace Terminal {
|
||||
*/
|
||||
Genode::size_t io_buffer_size = 4096;
|
||||
|
||||
Session_component *session =
|
||||
new (md_alloc()) Session_component(_env, *md_alloc(),
|
||||
_read_buffer,
|
||||
_framebuffer,
|
||||
io_buffer_size,
|
||||
_flush_callback_registry,
|
||||
_trigger_flush_callback,
|
||||
_font_family);
|
||||
return session;
|
||||
return new (md_alloc())
|
||||
Session_component(_env, *md_alloc(),
|
||||
_read_buffer,
|
||||
_framebuffer,
|
||||
io_buffer_size,
|
||||
_flush_callback_registry,
|
||||
_trigger_flush_callback,
|
||||
_font_family);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -532,7 +529,7 @@ struct Terminal::Main
|
||||
Input::Connection _input { _env };
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Sliced_heap _sliced_heap { _env.ram(), _env.rm() };
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
/* input read buffer */
|
||||
Read_buffer _read_buffer;
|
||||
@ -599,7 +596,7 @@ struct Terminal::Main
|
||||
unsigned char const *control)
|
||||
:
|
||||
_env(env),
|
||||
_root(_env, _sliced_heap,
|
||||
_root(_env, _heap,
|
||||
_read_buffer, _framebuffer,
|
||||
_flush_callback_registry,
|
||||
_trigger_flush_callback,
|
||||
|
@ -89,7 +89,14 @@ class Cell_array
|
||||
_array[i] = new (alloc) CELL[num_cols];
|
||||
}
|
||||
|
||||
/* XXX destructor is missing */
|
||||
~Cell_array()
|
||||
{
|
||||
for (unsigned i = 0; i < _num_lines; i++)
|
||||
Genode::destroy(_alloc, _array[i]);
|
||||
|
||||
Genode::destroy(_alloc, _line_dirty);
|
||||
Genode::destroy(_alloc, _array);
|
||||
}
|
||||
|
||||
void set_cell(int column, int line, CELL cell)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user