Remove Client::window() method, use a force_redraw() one

We cannot assume Client::m_window is always non-null, as when
changing current buffer its temporarily null, at the point
where WinCreate hook might get called.

Fixes #382
This commit is contained in:
Maxime Coste 2015-08-23 13:29:24 +01:00
parent dc504284c3
commit ae839fc471
3 changed files with 8 additions and 2 deletions

View File

@ -166,6 +166,12 @@ void Client::redraw_ifn()
ui.refresh();
}
void Client::force_redraw()
{
if (m_window)
m_window->force_redraw();
}
void Client::reload_buffer()
{
auto& buffer = context().buffer();

View File

@ -35,10 +35,10 @@ public:
void print_status(DisplayLine status_line);
void force_redraw();
void redraw_ifn();
UserInterface& ui() const { return *m_ui; }
Window& window() const { return *m_window; }
void check_if_buffer_needs_reloading();

View File

@ -1536,7 +1536,7 @@ const CommandDesc face_cmd = {
FaceRegistry::instance().register_alias(parser[0], parser[1], true);
for (auto& client : ClientManager::instance())
client->window().force_redraw();
client->force_redraw();
}
};