blob: f8a8b27501d44c4c11ec7d715502ab85c419017a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/**
* @author Felix Morgner (felix.morgner@gmail.com)
* @copyright Copyright (c) 2025
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "adwaitamm/helpers/async_callback.hpp"
#include <glibmm/exceptionhandler.h>
#include <glibmm/object.h>
#include <giomm/asyncresult.h>
#include <memory>
namespace Adwaita::helpers
{
auto async_callback(GObject *, GAsyncResult * result, void * data) noexcept -> void
{
auto slot = std::unique_ptr<Gio::SlotAsyncReady>(static_cast<Gio::SlotAsyncReady *>(data));
try
{
auto actual_result = Glib::wrap(result, true);
(*slot)(actual_result);
}
catch (...)
{
Glib::exception_handlers_invoke();
}
}
} // namespace Adwaita::helpers
|