Skip to content

Commit

Permalink
Fix GLib critical warnings on startup
Browse files Browse the repository at this point in the history
The result of vte_terminal_new is not owned by the caller and must not
be free'd.
  • Loading branch information
ximion committed Nov 6, 2023
1 parent f253b84 commit ee75c29
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/gx/gtk/vte.d
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ enum TerminalFeature {
DISABLE_BACKGROUND_DRAW
}

private static bool g_vteTerminalLoaded = false;

/**
* Determine which terminal features are supported.
*/
Expand All @@ -104,12 +106,12 @@ bool checkVTEFeature(TerminalFeature feature) {
// due to need for GTK to load first
if (!featuresInitialized) {
import vte.c.functions;
import gtk.c.functions : gtk_widget_destroy;

// Force terminal to be loaded if not done already
auto terminal = vte_terminal_new ();
scope(exit) {gtk_widget_destroy(terminal);}

if (!g_vteTerminalLoaded) {
g_vteTerminalLoaded = true;
auto terminal = vte_terminal_new ();
}

// Check if patched events are available
string[] events = ["notification-received", "terminal-screen-changed"];
Expand Down

0 comments on commit ee75c29

Please sign in to comment.