freeride-devel
[Top][All Lists]
Advanced

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

RE: [FR-devel] FreeRIDE Error -- make_current is an undefined method.


From: Curt Hibbs
Subject: RE: [FR-devel] FreeRIDE Error -- make_current is an undefined method.
Date: Mon, 15 Jul 2002 03:46:11 -0700

Rich Kilmer wrote:
>
> I see the jist of the problem.

Good work, Rich (more comments below)!

> At line 158 in EditPanes.rb
> renderer().make_current is called and renderer (the method) returns nil
> because the Fox renderer is NOT installed as the manager yet.  A couple
> of things to note:
>
> 1) The renderer method contains this code:
>
> def renderer
>  # get a renderer for this editpane
>  @renderer = @base_slot["../../render/address@hidden"].manager if
>    @renderer == nil
>  return @renderer
> end
>
> Just something to keep in mind.  I would highly recommend in using the
> Databus and manager objects that you don't keep a handle to the active
> manager, as a rule of thumb, but to slots.  Something like this:
>
> @render = @base_slot["../../render/address@hidden"]
>
> def make_current
>   @render.manager.make_current
>   @log_info << "Making EditPane #{base_slot.path} current"
> end
>
> The reason for this is in the ability to replace the manager of a slot
> at run time.  I know this may appear rare, but it may not.  Always going
> through the slot enable the abstraction to be complete.  This does not
> fix our problem, its just a pointer.

You are entirely correct -- the fault is mine.

The point was to cache the lookup of the renderer (which is the slot
manager) for efficiency. However, as you point out, it is the slot lookup
that should be cached, not the manager, itself.

> 2)  The problem of the renderer not existing during the make_current
> call:
>
> This is our problem...it appears that the EditPaneRenderFox renderer is
> not RUNNING at the time that this code is being called and is causing
> our exception.  There will need to be some refactoring to fix the
> problem.  I think that the way the abstraction between the EditPane and
> the Renderer needs to be looked at.
>
> A temporary fix is (in EditPane.rb):
>
> require 'singleton'
> class NilRenderer
>   include Singleton
>   def method_missing(meth, *args, &block); end
> end
>
> def renderer
>  # get a renderer for this editpane
>  @renderer = @base_slot["../../render/address@hidden"].manager if
>    @renderer == nil
>  return NilRenderer.instance unless @renderer
>  return @renderer
> end
>
> This "NilRenderer" will catch all method calls and just do nothing.  The
> renderer method will keep getting called until the Renderer is set by
> the EditPaneRenderFox plugin.  It's a hack, but it works.

I like the basic technique here. The only thing wrong is that the client
code should not have to do this.

To move it out of hack status all we need to do is to install your
NilRenderer as the manager of the base ui slot ("/system/ui") and make sure
that occurs before most other initializations in the UI system. As real
managers (renderers) get installed for various components, they will
override this NillRenderer in the base slot for their local subtree.

I'm getting ready to home leave for work right now. I will make this change
and check it in as soon as I get there.

> -rich
>
>
> > -----Original Message-----
> > From: address@hidden [mailto:freeride-
> > address@hidden On Behalf Of Rich Kilmer
> > Sent: Sunday, July 14, 2002 10:29 PM
> > To: address@hidden
> > Subject: RE: [FR-devel] FreeRIDE Error -- make_current is an undefined
> > method.
> >
> > We must have a race condition where some dependency is not where it
> > should be and it depending on the startup it works correctly (or
> > sometimes not).  I just checked out FreeRIDE from CVS and on a 1.7.2
> > Ruby install on Fox 1.0.11 on Mandrake 8.2 I get the error.
> >
> > So...we need to analyze the dependencies of that slot that is being
> set
> > to make sure they are in order.
> >
> > Log file attached
> >
> > -rich
> >
> > > -----Original Message-----
> > > From: address@hidden
> [mailto:freeride-
> > > address@hidden On Behalf Of Curt Hibbs
> > > Sent: Sunday, July 14, 2002 10:08 PM
> > > To: address@hidden
> > > Subject: RE: [FR-devel] FreeRIDE Error -- make_current is an
> undefined
> > > method.
> > >
> > > Laurent Julliard wrote:
> > > >
> > > >   I have committed all the changes ok in the CVS repo plus I
> > > > double-checked that there was no error when running FR from my
> > working
> > > > copy.
> > > >
> > > >   The patch suggested by Mizuho San is not necessary. The code as
> it
> > is,
> > > > is ok. The problem comes from the fact that the renderer() method
> > call
> > > > in EditPanes line 158 return nil which makes me think that the
> > > > EditPanesRenderFox plugin is not initialized.
> > > >
> > > > If this is so it means that the order in which plugins are
> > initialized
> > > > on your machine and mine is not the same. I guess this is a
> > dependency
> > > > problem that doesn't show up on Linux but shows up on Windows and
> it
> > is
> > > > probably related to the order in which the Core engine look at the
> > > > plugin directories and load them. So It's probably a dependency
> > problem
> > > > that is not correctly expressed and doesn't show on Linux.
> > > >
> > > > I have attached my freeride.log (simply start and choose Exit in
> the
> > > > file menu) so you can see how it compares with yours. I'm
> interested
> > in
> > > > seeing your log file as well.
> > > >
> > >
> > > I'm not trying to be lazy here, I'm just trying to get a Ruby system
> > (with
> > > FOX) built with full debug symbols so I can work on the threading
> > problem,
> > > and I wanted to check with you for the obvious, easy things befor
> > looking
> > > more deeply.
> > >
> > > Anyway, I've attached my log file (although I haven't even looked at
> > it
> > > yet
> > > myself -- maybe later tonight). Interestingly, it does work for me
> > under
> > > 1.7.2, but not with 1.6.7 so you suspicion that the order of plugin
> > > initialization may be fact be the problem.
> > >
> > > Curt
> > >
> > > >
> > > > >
> > > > > R:\freeride>ruby -I. -Iso -Iredist -e "require
> > 'freeride/freeride';
> > > > > FreeBASE::Core.startup('./config
> > > > > /properties.xml','./config/default.xml')"
> > > > > ./plugins/System_GuiCore/EditPanes.rb:158:in `make_current':
> > undefined
> > > > > method `make_current' for nil
> > > > >  (NameError)
> > > > >         from ./plugins/System_GuiCore/EditPanes.rb:43:in `start'
> > > > >         from ./plugins/System_GuiCore/EditPanes.rb:40:in `call'
> > > > >         from ./freebase/databus.rb:407:in `notify'
> > > > >         from ./freebase/databus.rb:404:in `each_value'
> > > > >         from ./freebase/databus.rb:404:in `notify'
> > > > >         from ./freebase/databus.rb:226:in `data='
> > > > >         from ./plugins/System_GuiCore/EditPanes.rb:129:in
> > `initialize'
> > > > >         from ./plugins/System_GuiCore/GuiSetup.rb:110:in `new'
> > > > >          ... 57 levels...
> > > > >         from ./freebase/core.rb:67:in `initialize'
> > > > >         from ./freebase/core.rb:35:in `new'
> > > > >         from ./freebase/core.rb:35:in `startup'
> > > > >         from -e:1
> > > > >
> > > > > R:\freeride>
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Freeride-devel mailing list
> > > > > address@hidden
> > > > > http://mail.freesoftware.fsf.org/mailman/listinfo/freeride-devel
> > > > >
> > > >
> > > >
> > > >
>
>
> _______________________________________________
> Freeride-devel mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/freeride-devel
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]