Fix file dialog memory leak

This commit is contained in:
David 2024-08-09 21:41:18 +02:00 committed by david-swift
parent 574aca245a
commit c6d0fa5080
22 changed files with 34 additions and 3 deletions

View File

@ -46,8 +46,8 @@ jobs:
- name: Modify Docs
run: |
echo "<script>window.location.href += \"/documentation/adwaita\"</script>" > docs/index.html;
sed -i '' 's/#06f/#ea3358/g' docs/css/documentation-topic~topic~tutorials-overview.d6f5411c.css
sed -i '' 's/,2px/,10px/g' docs/css/index.038e887c.css
sed -i '' 's/#06f/#ea3358/g' docs/css/documentation-topic~topic~tutorials-overview.*.css
sed -i '' 's/,2px/,10px/g' docs/css/index.*.css
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:

View File

@ -164,3 +164,4 @@ type_contents_order:
excluded:
- Sources/Adwaita/View/Generated/
- Sources/Adwaita/Adwaita.docc/
- .build/

View File

@ -112,6 +112,7 @@ public struct Binding<Value> {
}
/// An extension
extension Binding where Value: MutableCollection {
/// Get a child at a certain index of the array as a binding.
@ -134,6 +135,7 @@ extension Binding where Value: MutableCollection {
}
/// An extension
extension Binding where Value: MutableCollection, Value.Element: Identifiable {
/// Get a child of the array with a certain id as a binding.

View File

@ -185,6 +185,7 @@ public struct State<Value>: StateProtocol {
}
/// An extension
extension State where Value: Codable {
/// Initialize a property representing a state in the view.

View File

@ -7,6 +7,7 @@
import Foundation
// An extension
extension Array: View where Element == View {
/// The array's view body is the array itself.
@ -46,6 +47,7 @@ extension Array: View where Element == View {
}
// An extension
extension Array where Element == WindowSceneGroup {
/// Get the content of an array of window scene groups.
@ -56,6 +58,7 @@ extension Array where Element == WindowSceneGroup {
}
// An extension
extension Array where Element == String {
/// Get the C version of the array.
@ -78,6 +81,7 @@ extension Array where Element == String {
}
// An extension
extension Array {
/// Accesses the element at the specified position safely.
@ -105,6 +109,7 @@ extension Array {
}
// An extension
extension Array where Element: Identifiable {
/// Accesses the element with a certain id safely.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 15.01.24.
//
// An extension
extension Bool {
/// Get the gboolean for C.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 15.01.24.
//
// An extension
extension Int: Identifiable {
/// Get the integer itself as the identifier.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 15.01.23.
//
// An extension
extension OpaquePointer {
/// Convert an opaque pointer into an unsafe mutable pointer with a defined type.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 21.01.24.
//
// An extension
extension Set where Element == Edge {
/// Horizontal and vertical edges.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 09.09.23.
//
// An extension
extension String {
/// A label for main content in a view storage.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 19.01.24.
//
// An extension
extension UInt {
/// Convert an unsigned integer into the C form.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 15.01.24.
//
// An extension
extension UnsafeMutablePointer {
/// Convert into an opaque pointer.

View File

@ -5,6 +5,7 @@
// Created by david-swift on 15.01.24.
//
// An extension
extension UnsafeMutableRawPointer {
/// Convert into an unsafe mutable pointer of a certain type.

View File

@ -38,6 +38,7 @@ public protocol App {
}
/// An extension
extension App {
/// The application's entry point.

View File

@ -19,6 +19,7 @@ public protocol MenuItem: MenuItemGroup {
}
/// An extension
extension MenuItem {
/// The menu item's content is itself.

View File

@ -15,6 +15,7 @@ public protocol MenuItemGroup {
}
/// An extension
extension MenuItemGroup {
/// Add the menu items described by the group to a menu.

View File

@ -25,6 +25,7 @@ public protocol View {
}
/// An extension
extension View {
/// Wrap the view into a widget.
@ -54,6 +55,8 @@ extension View {
}
}
/// Get the state.
/// - Returns: The state.
func getState() -> [String: StateProtocol] {
var state: [String: StateProtocol] = [:]
for property in Mirror(reflecting: self).children {
@ -71,6 +74,9 @@ extension View {
widget(modifiers: modifiers).container(modifiers: modifiers)
}
/// Get the modified view.
/// - Parameter modifiers: The modifiers.
/// - Returns: The modified view.
func getModified(modifiers: [(View) -> View]) -> View {
var modified: View = self
for modifier in modifiers {

View File

@ -20,6 +20,7 @@ public protocol Widget: View {
}
/// An extension
extension Widget {
/// A widget's view is empty.

View File

@ -29,6 +29,7 @@ public protocol WindowScene: WindowSceneGroup {
}
/// An extension
extension WindowScene {
/// The window scene's body is itself.

View File

@ -13,6 +13,7 @@ public protocol WindowSceneGroup {
}
/// An extension
extension WindowSceneGroup {
/// Get the windows described by the group.

View File

@ -7,6 +7,7 @@
import CAdw
// An extension
extension Menu {
// swiftlint:disable function_default_parameter_at_end

View File

@ -27,7 +27,8 @@ static void
gtui_filedialog_open_finish (uint64_t dialog, uint64_t result, uint64_t data)
{
GFile *file = gtk_file_dialog_open_finish (dialog, result, NULL);
const char *path = g_file_get_path (file);
const char *path = g_file_peek_path (file);
g_object_unref (file);
filedialog_on_open_cb (dialog, path, data);
}