Skip to content

Commit

Permalink
toplevel-views: fix memory leak
Browse files Browse the repository at this point in the history
Introduced in #2312, we need to check for pending transactions, because
while applying, the toplevel is still marked as committed.
  • Loading branch information
ammen99 committed Apr 5, 2024
1 parent 5110f63 commit 793a5eb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/core/txn/transaction-manager-impl.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "wayfire/signal-provider.hpp"
#include "wayfire/txn/transaction.hpp"
#include <algorithm>
#include <iterator>
#include <wayfire/txn/transaction-manager.hpp>
#include <wayfire/debug.hpp>

Expand Down
3 changes: 1 addition & 2 deletions src/view/xdg-shell/xdg-toplevel-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ void wf::xdg_toplevel_view_t::handle_toplevel_state_changed(wf::toplevel_state_t
wf::view_implementation::emit_toplevel_state_change_signals({this}, old_state);
scene::update(this->get_surface_root_node(), scene::update_flag::GEOMETRY);

if (!wf::get_core().tx_manager->is_object_committed(wtoplevel) &&
!wf::get_core().tx_manager->is_object_pending(wtoplevel))
if (!wf::get_core().tx_manager->is_object_pending(wtoplevel))
{
// Drop self-ref => `this` might get deleted
_self_ref.reset();
Expand Down
3 changes: 1 addition & 2 deletions src/view/xwayland/xwayland-toplevel-view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ class wayfire_xwayland_view : public wf::toplevel_view_interface_t, public wayfi
wf::view_implementation::emit_toplevel_state_change_signals({this}, old_state);
wf::scene::update(this->get_surface_root_node(), wf::scene::update_flag::GEOMETRY);

if (!wf::get_core().tx_manager->is_object_committed(toplevel) &&
!wf::get_core().tx_manager->is_object_pending(toplevel))
if (!wf::get_core().tx_manager->is_object_pending(toplevel))
{
// Drop self-reference => object might be deleted afterwards
_self_ref.reset();
Expand Down

0 comments on commit 793a5eb

Please sign in to comment.