Re: [Banshee-List] Inconsistent bug when accessing DapDevice attribute



Finally had a chance to take a look...

Seems like HalDevice is somehow not set.  It's possible that this is a
race (as HalDevice is not immediately set when the DapDevice is
created).  After quickly tracing over the code for a few minutes
here...it looks like Initialize(device) gets called (which raises the
SourceManager.SourceAdded event) before DapCore.AddDevice is called
(which is what sets the HalDevice).

Try attaching your event handler to DapCore.DapAdded rather than
SourceManager.  This should work better :)

(by the way...if you do a Thread.Sleep(whatever)...this is going to stop
the main thread from executing and I believe will stop the Dap stuff
from getting done anyway...

Hope this helps!

Cheers,
Patrick


On Tue, 2007-07-10 at 15:47 -0400, Richard Bailey wrote:
> Hey Patrick, any luck isolating the bug? I have an idea for a
> workaround, but it's a bit of refactoring for something that, should
> work as is. Let me know cause I want to try to release the plugin by
> this weekend.
> 
> - RB
> 
> On 7/7/07, Richard Bailey <rmjb mail com> wrote:
>         Here is the stack trace: http://pastebin.ca/606840
>         
>         Hope this helps iron out the bug.
>         
>         - Richard
>         
>         
>         On 7/6/07, Richard Bailey <rmjb mail com> wrote:
>                 Hey Patrick, 
>                 
>                 Here's a pastebin of the method:
>                 http://pastebin.ca/606206
>                 
>                 The context that this is called is when a
>                 SourceManager.SourceAdded event happens a method in my
>                 plugin checks if the source is a DapSource, and if it
>                 is calls this AddDap method with the DapDevice in the
>                 DapSource. 
>                 
>                 The exception is thrown when dap.ID is accessed, but I
>                 already access dap.Name before this so the dap object
>                 exists.
>                 
>                 As I said before, if banshee is running and the Dap is
>                 plugged in the error happens, but if the Dap is
>                 plugged in then banshee is launched, the code works
>                 flawlessly. 
>                 
>                 I'll post the stack trace when I get home.
>                 
>                 - Richard
>                 
>                 
>                 On 7/6/07, Patrick van Staveren <trick vanstaveren us>
>                 wrote:
>                         Richard,
>                         
>                         Suppose you can show me the code you're
>                         using?  Drop me a tarball (off 
>                         the list, of course).  Or post a snip to
>                         pastebin.  Also drop a full
>                         stacktrace (in --debug mode so we get line
>                         numbers, please :)
>                         
>                         If you're talking about (string)
>                         DapDevice.ID...there's only a few code 
>                         paths that could lead to it being null, so it
>                         should be easy to track
>                         down :)
>                         
>                         Cheers,
>                         Patrick
>                         
>                         
>                         On Thu, 2007-07-05 at 22:25 -0400, Richard
>                         Bailey wrote:
>                         > I did some more testing on this.
>                         > I did a for loop for 10 counts trying to
>                         access the ID attribute of
>                         > the DapDevice object, if an exception
>                         occurred I Sleep one second and
>                         > try again. Again, I was not able to read
>                         that ID attribute even after 
>                         > 10 seconds.
>                         >
>                         > What is really strange is that if the Dap is
>                         plugged in before banshee
>                         > is run, then the exact same block of code,
>                         that reads dap.Name on one
>                         > line, then dap.ID on another works fine. So
>                         it has to be something 
>                         > with the initializing of the DapDevice
>                         itself.
>                         >
>                         > - Richard
>                         >
>                         > On 7/4/07, Richard Bailey <rmjb mail com>
>                         wrote:
>                         >         Hello,
>                         >
>                         >         I'm running into a strange bug when
>                         working on my plugin
>                         >         I've attached a listener to
>                         SourceManager.SourceAdded and when
>                         >         it's called I test if the source
>                         passed in the EventArgs is a 
>                         >         DapSource and work with it from
>                         there.
>                         >
>                         >         My strange behaviour is that I get a
>                         NullReferenceException
>                         >         when I access the ID property of the
>                         DapDevice object when I
>                         >         plugin my dap while banshee is
>                         running 
>                         >         but if I have my device already
>                         plugged in and THEN launch
>                         >         banshee, everything works fine
>                         >
>                         >         Is there a process that populates
>                         the DapDevice objects with
>                         >         information "gradually" that maybe
>                         I'm pre-stepping? 
>                         >
>                         >         I always successfully access the
>                         Name property of the
>                         >         DapDevice object though.
>                         >
>                         >         - Richard
>                         >
>                         >         --
>                         >         Reporter: What is your opinion on
>                         the obesity problem? 
>                         >         King: I prefer it to the famine
>                         problem
>                         >         - Wizard of ID
>                         >
>                         >
>                         >
>                         _______________________________________________
>                         > Banshee-list mailing list
>                         > Banshee-list gnome org
>                         >
>                         http://mail.gnome.org/mailman/listinfo/banshee-list 
>                         --
>                         Patrick "Trick" van Staveren
>                         http://trick.vanstaveren.us/
>                         
>                         _______________________________________________
>                         Banshee-list mailing list
>                         Banshee-list gnome org
>                         http://mail.gnome.org/mailman/listinfo/banshee-list
>                 
>                 
>                 
>                 -- 
>                 Reporter: What is your opinion on the obesity problem?
>                 King: I prefer it to the famine problem
>                 - Wizard of ID
>         
>         
>         
>         
>         -- 
>         
>         Reporter: What is your opinion on the obesity problem?
>         King: I prefer it to the famine problem 
>         - Wizard of ID
> 
> 
> 
> -- 
> Reporter: What is your opinion on the obesity problem?
> King: I prefer it to the famine problem
> - Wizard of ID 
> _______________________________________________
> Banshee-list mailing list
> Banshee-list gnome org
> http://mail.gnome.org/mailman/listinfo/banshee-list




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