Skip to content

Commit

Permalink
mag: Don't crash on unload when mag window is open with animate enabled
Browse files Browse the repository at this point in the history
This effectively disables animations when unloading the plugin with the
mag window still enabled but it prevents wayfire from crashing.
  • Loading branch information
soreau committed Oct 3, 2023
1 parent c310a61 commit d45478c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/mag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class mag_view_t : public wf::toplevel_view_interface_t

if (old_state.mapped && !_current.mapped)
{
view->unmap();
view->unmap(true);
}

wf::view_implementation::emit_toplevel_state_change_signals(view, old_state);
Expand Down Expand Up @@ -219,16 +219,25 @@ class mag_view_t : public wf::toplevel_view_interface_t
emit_view_map();
}

void unmap()
void unmap(bool animate)
{
emit_view_pre_unmap();
if (animate)
{
emit_view_pre_unmap();
}

_is_mapped = false;
wf::scene::set_node_enabled(get_root_node(), false);
emit_view_unmap();
}

void close() override
{
if (!_is_mapped)
{
return;
}

toplevel()->pending().mapped = false;
wf::get_core().tx_manager->schedule_object(toplevel());
}
Expand Down Expand Up @@ -432,6 +441,11 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t

void fini() override
{
if (mag_view)
{
mag_view->unmap(false);
}

deactivate();
output->rem_binding(&toggle_cb);
}
Expand Down

0 comments on commit d45478c

Please sign in to comment.