FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Some bugs

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
ShprotX



Joined: 28 Aug 2007
Posts: 24
Location: Ukraine

PostPosted: Fri Sep 07, 2007 7:55 am    Post subject: Some bugs Reply with quote

Looks like this forum is used as gtkD bugtrack so I'm posting bugs there.
Firstly, bugs in gtkD/src/glib/Str.d.
Code:
      char* arg = args[0];
      int i=0;
      while( (arg) != null && i<10)
      {
         argv ~= toString(arg);
         ++i;

why "i<10"?
Code:
public static char[] strdup(char[] str)
{
   // gchar* g_strdup (const gchar *str);
   return Str.toString(g_strdup(Str.toStringz(str)) );
}

Why not "return str"? And there are memory leak in this code. The same bug is in strndup, strnfill and a lot of others.
There are two ways to fix these bugs: to reimplement functions using D only (harder but better); correct usage of C implementations (simplier but unnecessary use memory).
Implementations of gstr_str_len and g_strstr are fully wrong because we need to return position of substring they search for but not string.
It's only a fourth part of the Str.d. I am afraid to look further.

gtkD/demos/cairo/clock.d
When compiling:
Code:
clock.d:73: Error: no property 'drawableGetSize' for type 'gdk.Drawable.Drawable'
clock.d:219: Error: no property 'drawableGetSize' for type 'gdk.Window.Window'

The correct name of "drawableGetSize" is "getSize".

Some mistakes in "GtkD Code Examples" (http://www.dsource.org/projects/dui/wiki/CodeExamples) are also taking place.
In "Popup Message":
Code:
import gtk.MainWindow;
-import gtk.gtktypes;
+import gtkc.gtktypes;
import gtk.Button;
import gtk.MessageDialog;
import gtk.GtkD;

In "Button Usage":
Code:

--- btn.d.old   2007-09-07 16:36:45.000000000 +0300
+++ btn.d       2007-09-07 16:47:25.000000000 +0300
@@ -1,11 +1,13 @@
-import gtk.Window;
+import gtk.MainWindow;
 import gtk.AboutDialog;
+import gtk.Dialog;
+import gtkc.gtktypes;
 import gtk.Label;
 import gtk.Button;
 import gtk.VBox;
 import gtk.GtkD;
 
-class ButtonUsage : Window
+class ButtonUsage : MainWindow
 {
        Label StatusLbl;
        this()
@@ -29,6 +31,10 @@
        {
                GtkD.exit(0);
        }
+       void OnDialogResponse(gint arg1, Dialog dialog)
+       {
+               dialog.hide();
+       }
        void onBtn3(Button button)
        {
                with (new AboutDialog())
@@ -38,6 +44,7 @@
                        names[i++] = cast(char*)"Jake Day (Okibi)";
                        setAuthors(names);
                        setWebsite("http://ddev.ratedo.com");
+                       addOnResponse(&OnDialogResponse);
                        showAll();
                }
        }

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group