Skip to content

Commit

Permalink
Use std::free for shared_generic_event_ptr
Browse files Browse the repository at this point in the history
Otherwise it would use `delete` which would probably trigger UB
  • Loading branch information
patrick96 committed Sep 13, 2022
1 parent 7a9960b commit 343dc77
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions include/xpp/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,30 +151,23 @@ class core
shared_generic_event_ptr
poll_for_event(void) const
{
return shared_generic_event_ptr(xcb_poll_for_event(m_c.get()));
return shared_generic_event_ptr(xcb_poll_for_event(m_c.get()), std::free);
}

virtual
shared_generic_event_ptr
poll_for_queued_event(void) const
{
return shared_generic_event_ptr(xcb_poll_for_queued_event(m_c.get()));
return shared_generic_event_ptr(xcb_poll_for_queued_event(m_c.get()), std::free);
}

virtual
shared_generic_event_ptr
poll_for_special_event(xcb_special_event_t * se) const
{
return shared_generic_event_ptr(xcb_poll_for_special_event(m_c.get(), se));
return shared_generic_event_ptr(xcb_poll_for_special_event(m_c.get(), se), std::free);
}

// virtual
// shared_generic_event_ptr
// poll_for_special_event(const std::shared_ptr<xcb_special_event_t> & se) const
// {
// return poll_for_special_event(se.get());
// }

virtual
shared_generic_event_ptr
wait_for_special_event(xcb_special_event_t * se) const
Expand All @@ -183,14 +176,6 @@ class core
xcb_wait_for_special_event(m_c.get(), se));
}

// virtual
// shared_generic_event_ptr
// wait_for_special_event(const std::shared_ptr<xcb_special_event_t> & se) const
// {
// return wait_for_special_event(se.get());
// }

// xcb_special_event_t has incomplete type -> no std::shared_ptr
virtual
xcb_special_event_t *
register_for_special_xge(xcb_extension_t * ext,
Expand Down

0 comments on commit 343dc77

Please sign in to comment.