# HG changeset patch # User Frank Benoit # Date 1211475647 -7200 # Node ID 34409a2fc053979833ba7a536d30992cfcd054e8 # Parent da992144273f78985f1dace1dec3b6e6dc7b3375 Fix call OS.gtk_label_set_text_with_mnemonic with valid ptr, even for zero length strings. diff -r da992144273f -r 34409a2fc053 dwt/widgets/Button.d --- a/dwt/widgets/Button.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/Button.d Thu May 22 19:00:47 2008 +0200 @@ -193,7 +193,7 @@ override void createHandle (int index) { state |= HANDLE; - if ((style & (DWT.PUSH | DWT.TOGGLE)) is 0) state |= THEME_BACKGROUND; + if ((style & (DWT.PUSH | DWT.TOGGLE)) is 0) state |= THEME_BACKGROUND; int bits = DWT.ARROW | DWT.TOGGLE | DWT.CHECK | DWT.RADIO | DWT.PUSH; fixedHandle = cast(GtkWidget*)OS.g_object_new (display.gtk_fixed_get_type (), null); if (fixedHandle is null) error (DWT.ERROR_NO_HANDLES); @@ -796,7 +796,7 @@ if ((style & DWT.ARROW) !is 0) return; text = string; char [] chars = fixMnemonic (string); - OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, toStringz(chars)); + OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr() ); if (image is null) OS.gtk_widget_hide (imageHandle); OS.gtk_widget_show (labelHandle); _setAlignment (style); diff -r da992144273f -r 34409a2fc053 dwt/widgets/Group.d --- a/dwt/widgets/Group.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/Group.d Thu May 22 19:00:47 2008 +0200 @@ -285,7 +285,7 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string; char [] chars = fixMnemonic (string); - OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, toStringz(chars)); + OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr()); if (string.length !is 0) { if (OS.gtk_frame_get_label_widget (cast(GtkFrame*)handle) is null) { OS.gtk_frame_set_label_widget (cast(GtkFrame*)handle, labelHandle); diff -r da992144273f -r 34409a2fc053 dwt/widgets/MenuItem.d --- a/dwt/widgets/MenuItem.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/MenuItem.d Thu May 22 19:00:47 2008 +0200 @@ -852,9 +852,8 @@ string = string.substring (0, index); } char [] chars = fixMnemonic (string); - char* buffer = toStringz( chars ); auto label = OS.gtk_bin_get_child (cast(GtkBin*)handle); - OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)label, buffer); + OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)label, chars.toStringzValidPtr() ); auto ptr = cast(char*)OS.g_malloc (accelString.length + 1); ptr[ 0 .. accelString.length ] = accelString; diff -r da992144273f -r 34409a2fc053 dwt/widgets/TabItem.d --- a/dwt/widgets/TabItem.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/TabItem.d Thu May 22 19:00:47 2008 +0200 @@ -345,8 +345,7 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); char [] chars = fixMnemonic (string); - char* buffer = tango.stdc.stringz.toStringz( chars); - OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer); + OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr() ); if (string.length !is 0) { OS.gtk_widget_show (labelHandle); } else { diff -r da992144273f -r 34409a2fc053 dwt/widgets/TableColumn.d --- a/dwt/widgets/TableColumn.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/TableColumn.d Thu May 22 19:00:47 2008 +0200 @@ -613,8 +613,7 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); char [] chars = fixMnemonic (string); - char* buffer = tango.stdc.stringz.toStringz( chars ); - OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer); + OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr() ); if (string.length !is 0) { OS.gtk_widget_show (labelHandle); } else { diff -r da992144273f -r 34409a2fc053 dwt/widgets/ToolItem.d --- a/dwt/widgets/ToolItem.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/ToolItem.d Thu May 22 19:00:47 2008 +0200 @@ -991,7 +991,7 @@ super.setText (string); if (labelHandle is null) return; char [] chars = fixMnemonic (string); - OS.gtk_label_set_text_with_mnemonic (labelHandle, toStringz(chars)); + OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr()); if (string.length !is 0) { OS.gtk_widget_show (labelHandle); } else { diff -r da992144273f -r 34409a2fc053 dwt/widgets/TreeColumn.d --- a/dwt/widgets/TreeColumn.d Mon May 19 22:20:13 2008 +0200 +++ b/dwt/widgets/TreeColumn.d Thu May 22 19:00:47 2008 +0200 @@ -608,8 +608,7 @@ if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); char [] chars = fixMnemonic (string); - char* buffer = tango.stdc.stringz.toStringz(chars); - OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer); + OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr()); if (string.length !is 0) { OS.gtk_widget_show (labelHandle); } else {