[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: knotify crash
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2001-04-28 0:20:52
[Download RAW message or body]

   Hi!

On Fri, Apr 27, 2001 at 07:41:17PM -0400, Jeff Tranter wrote:
> I looked a little further into this. There is a SIGPIPE, but it is ignored. 
> The crash is due to a SIGSEGV which seems to be happening here in
> kmedia2.h. The value of _cache is 0. This is code generated by mcopidl.
> Any ideas?
> 
> inline void Arts::PlayObject::play()
> {
>  _cache?static_cast<Arts::PlayObject_base*>(_cache)->play():static_cast<Arts: 
> PlayObject_base*>(_method_call())->play();
> }

Thats the typical case if you are calling a method on some object reference
that is null (i.e. isNull is true).

Well, *do not* call methods on object references that are null. It's described
a bit in the section on error handling in the aRts documentation. Basically,
you can do:

   SoundServerV2 server = ...;
   if(server.isNull())
   {
     no server, *do not call* methods
   }
   else
   {
     server ok, you can call methods here
   }

and even if the connection breaks (i.e. artsd crashes), doing so is OK
(server.error() will be set). But if you have code like

   Object bar = server.createObject("bar");

   or

   StereoEffectStack x = server.outstack();

then you have to check for null before calling methods on these, because
if the connection breaks, all methods returning objects will return null
references.

Just read the section on error handling - if there is anything unclear
on that, send me comments so I can clarify it. If you understood it, you
should be able to look at the code of knotify, and it should be clear where
to add a few more checks to make it safe.


By the way - at the last IRC meeting we discussed error handling in detail
(1.2), any news on the implementation of smarter connection-breaks handling
(/me looks at Tobias Anton)?

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         
_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic