gecko-dev/widget/gtk/GUniquePtr.h
Emilio Cobos Álvarez 969e514b9a Bug 1754275 - Port nsGIOService::OrgFreedesktopFileManager1ShowItems to use GDBusProxy. r=stransky
GDBusProxy is not deprecated, and allows having time outs.

Differential Revision: https://phabricator.services.mozilla.com/D138287
2022-02-10 12:19:59 +00:00

28 lines
735 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GUniquePtr_h_
#define GUniquePtr_h_
// Provides GUniquePtr to g_free a given pointer.
#include <glib.h>
#include "mozilla/UniquePtr.h"
namespace mozilla {
struct GFreeDeleter {
constexpr GFreeDeleter() = default;
void operator()(GError* aPtr) const { g_error_free(aPtr); }
void operator()(void* aPtr) const { g_free(aPtr); }
};
template <typename T>
using GUniquePtr = UniquePtr<T, GFreeDeleter>;
} // namespace mozilla
#endif