Skip to content

Commit

Permalink
fix: Fixed AccessViolationException that occurs in GLibSharp.dll afte…
Browse files Browse the repository at this point in the history
…r storage picker interaction
  • Loading branch information
Agsayt committed May 9, 2022
1 parent 3cdc26e commit 2bd123f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private async Task<StorageFile[]> OpenPickerAsync(bool multiple)
commitText = _picker.CommitButtonText;
}

FileChooserDialog dialog = new FileChooserDialog(
using FileChooserDialog dialog = new FileChooserDialog(
"Open",
GtkHost.Window,
FileChooserAction.Open,
Expand Down Expand Up @@ -77,8 +77,6 @@ private async Task<StorageFile[]> OpenPickerAsync(bool multiple)
}
}

dialog.Dispose();
dialog.Destroy();
return files.ToArray();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public FileSavePickerExtension(FileSavePicker owner)
commitText = _picker.CommitButtonText;
}

FileChooserDialog dialog = new FileChooserDialog(
using FileChooserDialog dialog = new FileChooserDialog(
"Save File",
GtkHost.Window,
FileChooserAction.Save,
Expand All @@ -49,8 +49,7 @@ public FileSavePickerExtension(FileSavePicker owner)
file = await StorageFile.GetFileFromPathAsync(dialog.Filename);
}

dialog.Dispose();
dialog.Destroy();

return file;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public FolderPickerExtension(FolderPicker owner)
commitText = _picker.CommitButtonText;
}

FileChooserDialog dialog = new FileChooserDialog(
using FileChooserDialog dialog = new FileChooserDialog(
"Select Folder",
GtkHost.Window,
FileChooserAction.SelectFolder,
Expand All @@ -49,8 +49,6 @@ public FolderPickerExtension(FolderPicker owner)
folder = await StorageFolder.GetFolderFromPathAsync(dialog.Filename);
}

dialog.Dispose();
dialog.Destroy();
return folder;
}
}
Expand Down

0 comments on commit 2bd123f

Please sign in to comment.