seed r41 - in trunk: libseed tests



Author: racarr
Date: Sun Oct 26 06:26:46 2008
New Revision: 41
URL: http://svn.gnome.org/viewvc/seed?rev=41&view=rev

Log:
Fix reference counting regression. Add test case.


Added:
   trunk/tests/gobject-scope.js   (contents, props changed)
Modified:
   trunk/libseed/seed-engine.c
   trunk/libseed/seed-types.c
   trunk/tests/run-tests.py

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Sun Oct 26 06:26:46 2008
@@ -140,7 +140,6 @@
 
 		ret = (JSObjectRef)seed_value_from_object(gobject);
 	
-		g_object_unref(gobject);
 		g_type_class_unref(oclass);
 	
 		g_free(params);

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Sun Oct 26 06:26:46 2008
@@ -90,17 +90,7 @@
 				}
 		}
 
-		// Is this going to work? g_free seems wrong, don't we need some
-		// variety of finalize. This is a pointer declared on the stack anyway.
-		// What is happening. You had &js_ref, after this ramblign comment
-		// I am changing it to js_ref, and protecting/unprotecting it.
-		object = g_object_ref(object);
-		//g_object_set_data_full(object, "js-ref", (gpointer)js_ref, 
-		//		       (GDestroyNotify) seed_unprotect_object);
-		/* I think we avoid the need for this
-		   g_object_add_toggle_ref(object,
-		   object_toggle_notify_cb,
-		   0); */
+		object = g_object_ref_sink(object);
 	
 		return js_ref;
 }

Added: trunk/tests/gobject-scope.js
==============================================================================
--- (empty file)
+++ trunk/tests/gobject-scope.js	Sun Oct 26 06:26:46 2008
@@ -0,0 +1,15 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:
+// STDERR:
+
+Seed.import_namespace("Gtk");
+
+Gtk.init(null, null);
+
+for(var i = 0; i < 100; i++)
+{
+    var button = new Gtk.Button({"label":"Test!"});
+}
+

Modified: trunk/tests/run-tests.py
==============================================================================
--- trunk/tests/run-tests.py	(original)
+++ trunk/tests/run-tests.py	Sun Oct 26 06:26:46 2008
@@ -35,8 +35,8 @@
 		rfile = open(f, "r")
 		test_code = rfile.readlines()
 		test_in = test_code[2].replace("// STDIN:","").rstrip().replace("\\n","\n");
-		test_out = test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n");
-		test_err = test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n");
+		test_out = "^" + test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n") + "$";
+		test_err = "^" + test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n") + "$";
 		
 		(n,out,err) = os.popen3("./" + f)
 		



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]