List Info

Thread: Patches for object tracking




Patches for object tracking
user name
2006-04-23 17:28:00
The following patches implement object tracking.  Note nasty
games I 
play to make the tracking global.  SWIG 1.3.30 won't need
this.  I also 
updated the minimum required SWIG version to 1.3.29.

Roy

C:\RubyDev>diff -b -u wxruby2_old/swig/typemap.i
wxruby2/swig/typemap.i  
--- wxruby2_old/swig/typemap.i	2006-04-20 21:56:04.000000000
-0400
+++ wxruby2/swig/typemap.i	2006-04-23 02:35:03.758764800
-0400
 -1,6
+1,7 
 #   Copyright 2004-2005 by Kevin Smith
 #   released under the MIT-style wxruby2 license
 
+%trackobjects;
 
 ###########################################################
###
 %typemap(in) wxString& {
 -45,11
+46,11 
 }
 
 %typemap(out) wxString& {
-	$result = rb_str_new2((const char
*)$1.mb_str(wxConvUTF8));
+	$result = rb_str_new2((const char
*)(*$1).mb_str(wxConvUTF8));
 }
 
 %typemap(out) const wxString& {
-	$result = rb_str_new2((const char
*)$1.mb_str(wxConvUTF8));
+	$result = rb_str_new2((const char
*)(*$1).mb_str(wxConvUTF8));
 }
 
 %apply wxString& { wxString* }
 -75,11
+76,6 
 	$1 = (TYPE($input) == T_STRING);
 }
 
-%typemap(out) void * {
-  $result = INT2NUM((int)$1);
-}
-
-
 ###########################################################
###
 
 %typemap(in) void* {
 -90,6
+86,10 
     $result = (VALUE)($1);
 }
 
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) void
* {
+	$1 = TRUE;
+}
+
 ###########################################################
###
 
 ###########################################################
###

C:\RubyDev>diff -b -u wxruby2_old/swig/fixmainmodule.rb
wxruby2/swig/fixmainmodule.rb  
--- wxruby2_old/swig/fixmainmodule.rb	2005-08-06
11:25:16.000000000 -0400
+++ wxruby2/swig/fixmainmodule.rb	2006-04-21
01:01:59.199670400 -0400
 -33,6
+33,28 
             line = "VALUE #{$main_module};"
 			found_main_module = true
         end
+
+        # Fix 1.3.29's ruby tracking
+        if(ENV['SWIGVER'] == 'SWIG Version 1.3.29')
+          if(line.index("static VALUE
swig_ruby_trackings"))
+            line = "VALUE swig_ruby_trackings =
0;"
+          end
+
+          if(line.index("static ID
swig_ruby_hash_delete"))
+            line = "ID swig_ruby_hash_delete =
0;"
+          end
+
+          if(line.index("swig_ruby_trackings =
rb_hash_new();"))
+            line = "  if(swig_ruby_trackings == 0)
{\n" +
+                   line;
+          end
+			
+          if(line.index("swig_ruby_hash_delete =
rb_intern(\"delete\");"))
+            line = line + "\n" +
+                   "  }";
+          end
+        end
+
         out.puts(line)
     end
 	if(!found_main_module)

C:\RubyDev>diff -b -u wxruby2_old/swig/fixmodule.rb
wxruby2/swig/fixmodule.rb  
--- wxruby2_old/swig/fixmodule.rb	2006-04-20
21:56:04.000000000 -0400
+++ wxruby2/swig/fixmodule.rb	2006-04-21 01:02:46.037019200
-0400
 -55,6
+55,27 
 				line = "//" + line
 			end
 			
+                        # Fix 1.3.29's ruby tracking
+                        if(ENV['SWIGVER'] == 'SWIG
Version 1.3.29')
+
+			  if(line.index("static VALUE
swig_ruby_trackings"))
+				line = "extern VALUE swig_ruby_trackings;"
+			  end
+                          if(line.index("static ID
swig_ruby_hash_delete"))
+				line = "extern ID swig_ruby_hash_delete;"
+			  end
+
+                         
if(line.index("swig_ruby_trackings =
rb_hash_new();"))
+				line = "  if(swig_ruby_trackings == 0)
{\n" +
+                                       line;
+			  end
+			
+                         
if(line.index("swig_ruby_hash_delete =
rb_intern(\"delete\");"))
+				line = line + "\n" +
+                                       "  }";
+			  end
+                        end
+
 			# instead of defining a new module,
 			if(line.index("rb_define_module(\"Wx"
))
 				# set this module equal to the real main module

C:\RubyDev>diff -b -u wxruby2_old/rake/rakewx.rb
wxruby2/rake/rakewx.rb  
--- wxruby2_old/rake/rakewx.rb	2006-04-20 21:56:04.000000000
-0400
+++ wxruby2/rake/rakewx.rb	2006-04-21 00:59:14.372660800
-0400
 -24,10
+24,11 
 		return false
 	end
 	if(!version || version.empty?)
-		puts('Doing slower check for SWIG 1.3.24')
+		puts('Doing slower check for SWIG 1.3.29')
 		version = `ruby swig/swigver.rb`
 	end
-	return (version >= "SWIG Version 1.3.24"
&& version < "SWIG Version 2")
+        ENV['SWIGVER'] = version
+	return (version >= "SWIG Version 1.3.29"
&& version < "SWIG Version 2")
 end
 
 def wx_config(opt)
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-25 01:10:18
I'm reluctant to check these in, as they have made things
distinctly
worse for me. These are the first patches I have tried to
apply tonight,
and they make almost anything in bigdemo crash immediately.
Here's the
stack trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211263296 (LWP 27912)]
0xb7866816 in SWIG_Ruby_NewPointerObj (ptr=0xbfd556a0,
type=0xb7c6d0a0,
flags=Variable "flags" is not available.
) at src/Button.cpp:1312
1312            if (strcmp(type->name, type_name) == 0) {
Current language:  auto; currently c++
(gdb) bt
#0  0xb7866816 in SWIG_Ruby_NewPointerObj (ptr=0xbfd556a0,
type=0xb7c6d0a0, flags=Variable "flags" is not
available.
) at src/Button.cpp:1312
#1  0xb786d740 in SwigDirector_wxButton::ProcessEvent
(this=0x82d2520,
event=0xbfd556a0) at src/Button.cpp:3236
#2  0xb73c4581 in wxAppBase::SendIdleEvents (this=0x8122a28,
win=0x82d2520, event=0xbfd556a0) at
../src/common/appcmn.cpp:431
#3  0xb73c45e5 in wxAppBase::SendIdleEvents (this=0x8122a28,
win=0x8226400, event=0xbfd556a0) at
../src/common/appcmn.cpp:440
#4  0xb73c4456 in wxAppBase::ProcessIdle (this=0x8122a28)
at ../src/common/appcmn.cpp:406
#5  0xb731072e in wxapp_idle_callback () at
../src/gtk/app.cpp:281
#6  0xb69b5750 in g_child_watch_add () from
/usr/lib/libglib-2.0.so.0
#7  0xb69b34ee in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0
#8  0xb69b64f6 in g_main_context_check () from
/usr/lib/libglib-2.0.so.0
#9  0xb69b67e3 in g_main_loop_run () from
/usr/lib/libglib-2.0.so.0
#10 0xb6d6ce65 in gtk_main () from
/usr/lib/libgtk-x11-2.0.so.0
#11 0xb73311c0 in wxEventLoop::Run (this=0x82a0c88)
at ../src/gtk/evtloop.cpp:80
#12 0xb73c4123 in wxAppBase::MainLoop (this=0x8122a28)
at ../src/common/appcmn.cpp:272
#13 0xb73c42af in wxAppBase::OnRun (this=0x8122a28)
at ../src/common/appcmn.cpp:340
#14 0xb70c3441 in wxEntry (argc=0xb7c6d3c8,
argv=0xb7c6d3c0)
at ../src/common/init.cpp:439
#15 0xb784b558 in _wrap_App_main_loop (argc=0, argv=0x0,
self=3061730980) at src/App.cpp:1650
#16 0xb7e9264a in rb_iterator_p () from
/usr/lib/libruby1.8.so.1.8
#17 0xb7e9d07c in rb_thread_trap_eval () from
/usr/lib/libruby1.8.so.1.8
#18 0xb7e9db82 in rb_thread_trap_eval () from
/usr/lib/libruby1.8.so.1.8
#19 0xb7e9a478 in rb_thread_trap_eval () from
/usr/lib/libruby1.8.so.1.8
#20 0xb7ea7586 in rb_eval_string () from
/usr/lib/libruby1.8.so.1.8
#21 0xb7ea75d6 in ruby_exec () from
/usr/lib/libruby1.8.so.1.8
#22 0xb7ea9715 in ruby_run () from
/usr/lib/libruby1.8.so.1.8
#23 0x080486ac in main ()


Any thoughts before I dive in and try to figure it out
myself?

Kevin



On Sun, 2006-04-23 at 13:28 -0400, Roy Sutton wrote:
> The following patches implement object tracking.  Note
nasty games I 
> play to make the tracking global.  SWIG 1.3.30 won't
need this.  I also 
> updated the minimum required SWIG version to 1.3.29.
> 
> Roy


_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-25 02:57:19
Kevin Smith wrote:
> I'm reluctant to check these in, as they have made
things distinctly
> worse for me. These are the first patches I have tried
to apply tonight,
> and they make almost anything in bigdemo crash
immediately. Here's the
> stack trace:
Wow.  On Windows I couldn't detect any differences between
tracking and 
no tracking.  I have set up an Ubuntu box with the idea of
checking out 
wxRuby on it (and also doing some Rails stuff), maybe it's
time to try 
testing it there.  The box is at the office, though, so I
don't get to 
work on it much.  Some days working on this stuff is like
carving 
something out of wood and discovering a big rotted area
beneath what 
looks like good wood.  I'm looking forward to the day when
some change 
doesn't uncover a ton of other problems!

Roy
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 19:44:26
On Mon, 2006-04-24 at 21:10 -0400, Kevin Smith wrote:
> I'm reluctant to check these in, as they have made
things distinctly
> worse for me. These are the first patches I have tried
to apply tonight,
> and they make almost anything in bigdemo crash
immediately. 

I found the easiest way to duplicate the problem was to run
the
minimal.rb sample, do Help/About, and hit OK to close the
box.

Then I discovered that the SWIG code was dereferencing some
internal
value, and it was expecting a normal Ruby object, but the
value actually
contained Qnil. I don't know why.

I updated the SWIG post-processors to allow for this case,
and now
everything works quite smoothly. I was able to run several
samples,
performing several operations in each, with no crashes. I
did get one
segfault upon exiting bigdemo though, so it's not perfect
yet.

So Roy's patch, and my additional patch, are both checked
in. At least
theoretically, we have object tracking now.

Kevin


_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 20:02:46
Kevin,

Glad you tracked that down.  Actually, the minimal sample
crashes for me 
on Windows (before applying your patch).  I believe it's
because it 
explicitly does a GC.start in the help box.  This has to do
with object 
tracking, which is not fully implemented yet.  I will try
out your 
patches to see if they resolve any other problems I've
seen.  I'm 
spinning my wheels at the moment trying to decide what to
tackle.  I 
think the most important thing is the typemap problem with
the 
externalLeading stuff.  Alex's patch didn't make it work
right for me 
(though I may have applied it wrong?).  If we can't track
it down we'll 
have to manually update that code.

On an unrelated note, how strongly are you for/against
mixing in SWIG 
directives into our .h files?  I think it may be the only
way to apply 
certain typemaps, since you can't apply typemaps by
function name, only 
argument.

Roy

Kevin Smith wrote:
> On Mon, 2006-04-24 at 21:10 -0400, Kevin Smith wrote:
>   
>> I'm reluctant to check these in, as they have made
things distinctly
>> worse for me. These are the first patches I have
tried to apply tonight,
>> and they make almost anything in bigdemo crash
immediately. 
>>     
>
> I found the easiest way to duplicate the problem was to
run the
> minimal.rb sample, do Help/About, and hit OK to close
the box.
>
> Then I discovered that the SWIG code was dereferencing
some internal
> value, and it was expecting a normal Ruby object, but
the value actually
> contained Qnil. I don't know why.
>
> I updated the SWIG post-processors to allow for this
case, and now
> everything works quite smoothly. I was able to run
several samples,
> performing several operations in each, with no crashes.
I did get one
> segfault upon exiting bigdemo though, so it's not
perfect yet.
>
> So Roy's patch, and my additional patch, are both
checked in. At least
> theoretically, we have object tracking now.
>
> Kevin
>
>
> _______________________________________________
> wxruby-users mailing list
> wxruby-usersrubyforge.org
> ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
>
>
>
>   
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 20:15:26
On Sat, 2006-04-29 at 16:02 -0400, Roy Sutton wrote:
> I'm spinning my wheels at the moment trying to decide
what to tackle.  

One of my own pet peeves is all the compile warnings.
Especially the new
"dh is not used". If there's a simple way to
fix the code emission to
avoid them, that would be great. I don't want to tweak
compiler command
lines to simply hide the warnings, though.

Of course, for me, bigdemo still has the splitter problem.
I'll take a
look at that myself this afternoon.

Beyond that, I'm afraid I really haven't used wx enough
recently to know
what is most pressing.

> On an unrelated note, how strongly are you for/against
mixing in SWIG 
> directives into our .h files?  I think it may be the
only way to apply 
> certain typemaps, since you can't apply typemaps by
function name, only 
> argument.

I guess I would have to see an example to know how I feel
about it.

Kevin


_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 20:40:07
On Sat, 2006-04-29 at 16:15 -0400, Kevin Smith wrote:
> Of course, for me, bigdemo still has the splitter
problem. I'll take a
> look at that myself this afternoon.

Fixed. Turns out the default splitter location was so high
that it was
underneath the notebook tabs. So I couldn't grab it with
the mouse to
resize it. I changed the minimum split panel size from 20 to
100, and
that fixed it. I can now really use the bigdemo! Woo-hoo!

Kevin


_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 20:34:07
Kevin Smith wrote:
> On Sat, 2006-04-29 at 16:02 -0400, Roy Sutton wrote:
>   
>> I'm spinning my wheels at the moment trying to
decide what to tackle.  
>>     
>
> One of my own pet peeves is all the compile warnings.
Especially the new
> "dh is not used". If there's a simple way
to fix the code emission to
> avoid them, that would be great. I don't want to tweak
compiler command
> lines to simply hide the warnings, though.
>   
I know exactly what you mean.  I insist on a clean compile
on everything 
else.  I was just taking a look at the new, recurring SWIG
warning 
(Warning(473): Returning a pointer...).
>> On an unrelated note, how strongly are you
for/against mixing in SWIG 
>> directives into our .h files?  I think it may be
the only way to apply 
>> certain typemaps, since you can't apply typemaps
by function name, only 
>> argument.
>>     
>
> I guess I would have to see an example to know how I
feel about it.
If I have to do it to wrap something I'll send in an
example.  I haven't 
had to do it yet.

Roy
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 20:51:22
Kevin Smith wrote:
> On Sat, 2006-04-29 at 16:15 -0400, Kevin Smith wrote:
>   
>> Of course, for me, bigdemo still has the splitter
problem. I'll take a
>> look at that myself this afternoon.
>>     
>
> Fixed. Turns out the default splitter location was so
high that it was
> underneath the notebook tabs. So I couldn't grab it
with the mouse to
> resize it. I changed the minimum split panel size from
20 to 100, and
> that fixed it. I can now really use the bigdemo!
Woo-hoo!
Great!  This reminds me of another problem I see.  On
Windows, all the 
drop-downs (combo box, listbox) don't drop down far enough
to reveal 
their contents.  It appears that the size of the control is
set such 
that it specifies the max height for the control when it's
expanded.  Is 
this a bug in wxWindows?  Is this bug only visible on
Windows or does it 
happen elsewhere, too?  I saw a bug in the wxWindows bug
tracker related 
to problems with putting combos on resizable items, perhaps
it's related.

Roy
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
Patches for object tracking
user name
2006-04-29 20:50:20
Hi Kevin,

Kevin Smith wrote:

>On Sat, 2006-04-29 at 16:15 -0400, Kevin Smith wrote:
>  
>
> I can now really use the bigdemo! Woo-hoo!
>  
>

Cool! For spectators like me, who are eagerly waiting to dig
their hands 
in writing GUI applications using wxruby2, how far are we
from getting a 
preview release?

Million Thanks for all the hard work you guys are putting in


-- Shashank


_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
[1-10] [11-13]

about | contact  Other archives ( Real Estate discussion Medical topics )