patch for incomplete CSOUND segfault

View: New views
8 Messages — Rating Filter:   Alert me  

patch for incomplete CSOUND segfault

by Wade Brainerd-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
be left in an incomplete state.  Calling a performance function on an
incomplete CSOUND, or starting a performance thread (part of the SWIG
interfaces) can lead to a segfault.

I encountered this while testing Art Hunkins' OurMusic Sugar activity.
 The segfault occurred when I opened a .csd file that required a MIDI
input device, and I did not have one in my machine.

I developed a patch and posted it to this Fedora bug:
https://bugzilla.redhat.com/show_bug.cgi?id=529293
The patch delays setting the COMP flag until csoundCompile returns
success.  The performance functions check for the presence of the COMP
flag before performing.

Best,
Wade

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's good thanks, but this is generally averted by checking the
result of a call to Compile(). Is Art Hunkis' code doing this? That is
what is supposed to be done. If it returns an error, then no further
calls should be made to performance functions.

Victor


----- Original Message -----
From: "Wade Brainerd" <wadetb@...>
To: <csound-devel@...>
Sent: Friday, October 16, 2009 3:31 AM
Subject: [Cs-dev] patch for incomplete CSOUND segfault


> Hi all,
>
> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
> be left in an incomplete state.  Calling a performance function on an
> incomplete CSOUND, or starting a performance thread (part of the SWIG
> interfaces) can lead to a segfault.
>
> I encountered this while testing Art Hunkins' OurMusic Sugar activity.
> The segfault occurred when I opened a .csd file that required a MIDI
> input device, and I did not have one in my machine.
>
> I developed a patch and posted it to this Fedora bug:
> https://bugzilla.redhat.com/show_bug.cgi?id=529293
> The patch delays setting the COMP flag until csoundCompile returns
> success.  The performance functions check for the presence of the COMP
> flag before performing.
>
> Best,
> Wade
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Art Hunkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Wade.

This seems quite helpful; the crash otherwise seems rather problematic for
the user.

Will, by any chance, this patch eventually propagate to the XO-1 (Sugar 82),
which shows identical behavior? (I.e., will it be an update to its OLPCsound
5.08? Just asking; I don't suppose its a realistic possibility, and
certainly not anything of major importance.)

Art Hunkins

----- Original Message -----
From: "Wade Brainerd" <wadetb@...>
To: <csound-devel@...>
Sent: Thursday, October 15, 2009 10:31 PM
Subject: [Cs-dev] patch for incomplete CSOUND segfault


> Hi all,
>
> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
> be left in an incomplete state.  Calling a performance function on an
> incomplete CSOUND, or starting a performance thread (part of the SWIG
> interfaces) can lead to a segfault.
>
> I encountered this while testing Art Hunkins' OurMusic Sugar activity.
> The segfault occurred when I opened a .csd file that required a MIDI
> input device, and I did not have one in my machine.
>
> I developed a patch and posted it to this Fedora bug:
> https://bugzilla.redhat.com/show_bug.cgi?id=529293
> The patch delays setting the COMP flag until csoundCompile returns
> success.  The performance functions check for the presence of the COMP
> flag before performing.
>
> Best,
> Wade
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Art Hunkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Victor,

No, my code doesn't do that. It seems I should add it. I'm using the csd
method from your csndsugui.

The relevent code is:

def version1(self, widget):
   if self.ver != 0:
     self.box1.destroy()
     self.box2.destroy()
   self.ver = 1
   self.box1 = self.w.box(True, self.bb)
   self.w.text("", self.box1)
   self.box2 = self.w.box(True, self.bb)
   self.f = self.w.framebox(" <b>1 - MyMusicMIDI</b> ", False, self.box2,
self.r)
   self.b1 = self.w.box(True, self.f)
   self.b2 = self.w.box(True, self.f)
   self.b3 = self.w.box(True, self.f)
   self.w.reset()
   self.w.csd("MyMusicMIDI.csd")
   self.w.spin(1, 0, 15, 1, 1, self.b1, 0, "chan", "Channel #  [0=CC7,\n  \
channels 1-8(9)]")

I presume the csd line should be changed to something like:
  self.res = self.w.csd("MyMusicMIDI.csd")
and then add:
  if self.res:
followed by some sort of exit statement. (I'm, as you know, a neophyte
python person.)

Could you please help with the details? I also assume this check should be
added even when MIDI is not involved, to head off any type of compile
error - correct?

TIA

Art Hunkins

----- Original Message -----
From: "victor" <Victor.Lazzarini@...>
To: "Developer discussions" <csound-devel@...>
Sent: Sunday, October 18, 2009 12:00 PM
Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault


> That's good thanks, but this is generally averted by checking the
> result of a call to Compile(). Is Art Hunkis' code doing this? That is
> what is supposed to be done. If it returns an error, then no further
> calls should be made to performance functions.
>
> Victor
>
>
> ----- Original Message -----
> From: "Wade Brainerd" <wadetb@...>
> To: <csound-devel@...>
> Sent: Friday, October 16, 2009 3:31 AM
> Subject: [Cs-dev] patch for incomplete CSOUND segfault
>
>
>> Hi all,
>>
>> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
>> be left in an incomplete state.  Calling a performance function on an
>> incomplete CSOUND, or starting a performance thread (part of the SWIG
>> interfaces) can lead to a segfault.
>>
>> I encountered this while testing Art Hunkins' OurMusic Sugar activity.
>> The segfault occurred when I opened a .csd file that required a MIDI
>> input device, and I did not have one in my machine.
>>
>> I developed a patch and posted it to this Fedora bug:
>> https://bugzilla.redhat.com/show_bug.cgi?id=529293
>> The patch delays setting the COMP flag until csoundCompile returns
>> success.  The performance functions check for the presence of the COMP
>> flag before performing.
>>
>> Best,
>> Wade
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Something like this:

if self.w.csd(...):
   ...

Perhaps you can place that call at the very top. You might not need an
'else'.
Just don't proceed to the rest of the program.

Victor


possibly.

----- Original Message -----
From: "Art Hunkins" <abhunkin@...>
To: "Developer discussions" <csound-devel@...>
Sent: Tuesday, October 20, 2009 4:15 AM
Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault


> Victor,
>
> No, my code doesn't do that. It seems I should add it. I'm using the csd
> method from your csndsugui.
>
> The relevent code is:
>
> def version1(self, widget):
>   if self.ver != 0:
>     self.box1.destroy()
>     self.box2.destroy()
>   self.ver = 1
>   self.box1 = self.w.box(True, self.bb)
>   self.w.text("", self.box1)
>   self.box2 = self.w.box(True, self.bb)
>   self.f = self.w.framebox(" <b>1 - MyMusicMIDI</b> ", False, self.box2,
> self.r)
>   self.b1 = self.w.box(True, self.f)
>   self.b2 = self.w.box(True, self.f)
>   self.b3 = self.w.box(True, self.f)
>   self.w.reset()
>   self.w.csd("MyMusicMIDI.csd")
>   self.w.spin(1, 0, 15, 1, 1, self.b1, 0, "chan", "Channel #  [0=CC7,\n  \
> channels 1-8(9)]")
>
> I presume the csd line should be changed to something like:
>  self.res = self.w.csd("MyMusicMIDI.csd")
> and then add:
>  if self.res:
> followed by some sort of exit statement. (I'm, as you know, a neophyte
> python person.)
>
> Could you please help with the details? I also assume this check should be
> added even when MIDI is not involved, to head off any type of compile
> error - correct?
>
> TIA
>
> Art Hunkins
>
> ----- Original Message -----
> From: "victor" <Victor.Lazzarini@...>
> To: "Developer discussions" <csound-devel@...>
> Sent: Sunday, October 18, 2009 12:00 PM
> Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault
>
>
>> That's good thanks, but this is generally averted by checking the
>> result of a call to Compile(). Is Art Hunkis' code doing this? That is
>> what is supposed to be done. If it returns an error, then no further
>> calls should be made to performance functions.
>>
>> Victor
>>
>>
>> ----- Original Message -----
>> From: "Wade Brainerd" <wadetb@...>
>> To: <csound-devel@...>
>> Sent: Friday, October 16, 2009 3:31 AM
>> Subject: [Cs-dev] patch for incomplete CSOUND segfault
>>
>>
>>> Hi all,
>>>
>>> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
>>> be left in an incomplete state.  Calling a performance function on an
>>> incomplete CSOUND, or starting a performance thread (part of the SWIG
>>> interfaces) can lead to a segfault.
>>>
>>> I encountered this while testing Art Hunkins' OurMusic Sugar activity.
>>> The segfault occurred when I opened a .csd file that required a MIDI
>>> input device, and I did not have one in my machine.
>>>
>>> I developed a patch and posted it to this Fedora bug:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=529293
>>> The patch delays setting the COMP flag until csoundCompile returns
>>> success.  The performance functions check for the presence of the COMP
>>> flag before performing.
>>>
>>> Best,
>>> Wade
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and
>>> stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, what I meant was:

if not self.w.csd():
   ...

The method returns 0 if successful and an error code if not.

Victor


----- Original Message -----
From: "Art Hunkins" <abhunkin@...>
To: "Developer discussions" <csound-devel@...>
Sent: Tuesday, October 20, 2009 4:15 AM
Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault


> Victor,
>
> No, my code doesn't do that. It seems I should add it. I'm using the csd
> method from your csndsugui.
>
> The relevent code is:
>
> def version1(self, widget):
>   if self.ver != 0:
>     self.box1.destroy()
>     self.box2.destroy()
>   self.ver = 1
>   self.box1 = self.w.box(True, self.bb)
>   self.w.text("", self.box1)
>   self.box2 = self.w.box(True, self.bb)
>   self.f = self.w.framebox(" <b>1 - MyMusicMIDI</b> ", False, self.box2,
> self.r)
>   self.b1 = self.w.box(True, self.f)
>   self.b2 = self.w.box(True, self.f)
>   self.b3 = self.w.box(True, self.f)
>   self.w.reset()
>   self.w.csd("MyMusicMIDI.csd")
>   self.w.spin(1, 0, 15, 1, 1, self.b1, 0, "chan", "Channel #  [0=CC7,\n  \
> channels 1-8(9)]")
>
> I presume the csd line should be changed to something like:
>  self.res = self.w.csd("MyMusicMIDI.csd")
> and then add:
>  if self.res:
> followed by some sort of exit statement. (I'm, as you know, a neophyte
> python person.)
>
> Could you please help with the details? I also assume this check should be
> added even when MIDI is not involved, to head off any type of compile
> error - correct?
>
> TIA
>
> Art Hunkins
>
> ----- Original Message -----
> From: "victor" <Victor.Lazzarini@...>
> To: "Developer discussions" <csound-devel@...>
> Sent: Sunday, October 18, 2009 12:00 PM
> Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault
>
>
>> That's good thanks, but this is generally averted by checking the
>> result of a call to Compile(). Is Art Hunkis' code doing this? That is
>> what is supposed to be done. If it returns an error, then no further
>> calls should be made to performance functions.
>>
>> Victor
>>
>>
>> ----- Original Message -----
>> From: "Wade Brainerd" <wadetb@...>
>> To: <csound-devel@...>
>> Sent: Friday, October 16, 2009 3:31 AM
>> Subject: [Cs-dev] patch for incomplete CSOUND segfault
>>
>>
>>> Hi all,
>>>
>>> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
>>> be left in an incomplete state.  Calling a performance function on an
>>> incomplete CSOUND, or starting a performance thread (part of the SWIG
>>> interfaces) can lead to a segfault.
>>>
>>> I encountered this while testing Art Hunkins' OurMusic Sugar activity.
>>> The segfault occurred when I opened a .csd file that required a MIDI
>>> input device, and I did not have one in my machine.
>>>
>>> I developed a patch and posted it to this Fedora bug:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=529293
>>> The patch delays setting the COMP flag until csoundCompile returns
>>> success.  The performance functions check for the presence of the COMP
>>> flag before performing.
>>>
>>> Best,
>>> Wade
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and
>>> stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Art Hunkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Victor,

In csndsugui, your csd function is:
     def csd(self, name):
         """Sets the source CSD and compiles it.
             name: CSD filename
             returns zero if successful"""
         path = activity.get_bundle_path()
         if self.ready:
           res = self.csound.Compile("%s/%s" % (path,name))
         if not res:
          self.ready = False
          self.focus_connect()
         self.path = path
         self.name = name
         return res

Shouldn't it be this (notice indents)? Or something else?

     def csd(self, name):
         """Sets the source CSD and compiles it.
             name: CSD filename
             returns zero if successful"""
         path = activity.get_bundle_path()
         if self.ready:
           res = self.csound.Compile("%s/%s" % (path,name))
           if not res:
            self.ready = False
            self.focus_connect()
            self.path = path
            self.name = name
            return res

Otherwise, I get "res not defined" in some cases. As you know, I need to
test against "return res" to see if the compile was good. (And I assume that
a bad MIDI setup - no or wrong MIDI device - will result in a bad compile
and no execution of my .csd)

Art Hunkins

----- Original Message -----
From: "victor" <Victor.Lazzarini@...>
To: "Developer discussions" <csound-devel@...>
Sent: Sunday, October 18, 2009 12:00 PM
Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault


> That's good thanks, but this is generally averted by checking the
> result of a call to Compile(). Is Art Hunkis' code doing this? That is
> what is supposed to be done. If it returns an error, then no further
> calls should be made to performance functions.
>
> Victor
>
>
> ----- Original Message -----
> From: "Wade Brainerd" <wadetb@...>
> To: <csound-devel@...>
> Sent: Friday, October 16, 2009 3:31 AM
> Subject: [Cs-dev] patch for incomplete CSOUND segfault
>
>
>> Hi all,
>>
>> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND can
>> be left in an incomplete state.  Calling a performance function on an
>> incomplete CSOUND, or starting a performance thread (part of the SWIG
>> interfaces) can lead to a segfault.
>>
>> I encountered this while testing Art Hunkins' OurMusic Sugar activity.
>> The segfault occurred when I opened a .csd file that required a MIDI
>> input device, and I did not have one in my machine.
>>
>> I developed a patch and posted it to this Fedora bug:
>> https://bugzilla.redhat.com/show_bug.cgi?id=529293
>> The patch delays setting the COMP flag until csoundCompile returns
>> success.  The performance functions check for the presence of the COMP
>> flag before performing.
>>
>> Best,
>> Wade
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: patch for incomplete CSOUND segfault

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes, the indentation you suggest is the correct one.

Victor
On 22 Oct 2009, at 19:01, Art Hunkins wrote:

> Victor,
>
> In csndsugui, your csd function is:
>     def csd(self, name):
>         """Sets the source CSD and compiles it.
>             name: CSD filename
>             returns zero if successful"""
>         path = activity.get_bundle_path()
>         if self.ready:
>           res = self.csound.Compile("%s/%s" % (path,name))
>         if not res:
>          self.ready = False
>          self.focus_connect()
>         self.path = path
>         self.name = name
>         return res
>
> Shouldn't it be this (notice indents)? Or something else?
>
>     def csd(self, name):
>         """Sets the source CSD and compiles it.
>             name: CSD filename
>             returns zero if successful"""
>         path = activity.get_bundle_path()
>         if self.ready:
>           res = self.csound.Compile("%s/%s" % (path,name))
>           if not res:
>            self.ready = False
>            self.focus_connect()
>            self.path = path
>            self.name = name
>            return res
>
> Otherwise, I get "res not defined" in some cases. As you know, I  
> need to
> test against "return res" to see if the compile was good. (And I  
> assume that
> a bad MIDI setup - no or wrong MIDI device - will result in a bad  
> compile
> and no execution of my .csd)
>
> Art Hunkins
>
> ----- Original Message -----
> From: "victor" <Victor.Lazzarini@...>
> To: "Developer discussions" <csound-devel@...>
> Sent: Sunday, October 18, 2009 12:00 PM
> Subject: Re: [Cs-dev] patch for incomplete CSOUND segfault
>
>
>> That's good thanks, but this is generally averted by checking the
>> result of a call to Compile(). Is Art Hunkis' code doing this? That  
>> is
>> what is supposed to be done. If it returns an error, then no further
>> calls should be made to performance functions.
>>
>> Victor
>>
>>
>> ----- Original Message -----
>> From: "Wade Brainerd" <wadetb@...>
>> To: <csound-devel@...>
>> Sent: Friday, October 16, 2009 3:31 AM
>> Subject: [Cs-dev] patch for incomplete CSOUND segfault
>>
>>
>>> Hi all,
>>>
>>> When a sound fails to compile (e.g. SetJmp is invoked) the CSOUND  
>>> can
>>> be left in an incomplete state.  Calling a performance function on  
>>> an
>>> incomplete CSOUND, or starting a performance thread (part of the  
>>> SWIG
>>> interfaces) can lead to a segfault.
>>>
>>> I encountered this while testing Art Hunkins' OurMusic Sugar  
>>> activity.
>>> The segfault occurred when I opened a .csd file that required a MIDI
>>> input device, and I did not have one in my machine.
>>>
>>> I developed a patch and posted it to this Fedora bug:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=529293
>>> The patch delays setting the COMP flag until csoundCompile returns
>>> success.  The performance functions check for the presence of the  
>>> COMP
>>> flag before performing.
>>>
>>> Best,
>>> Wade
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year.  
>>> Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market  
>>> and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register  
>>> now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel