Mailing List archive

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

[vdr] Re: Segmentation Fault with Remote Plugin



Oliver Endriss wrote:
> 
> Hi,
> I wrote a remote control plugin for the NEWSTRUCT+Hauppauge remote
> control. If this plugin is loaded and vdr terminates (e.g. restart), it
> crashes with a segmentation fault.
> 
> gdb:
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1024 (LWP 8934)]
> 0x0808c831 in Clear__9cListBase (this=0x80c9bec) at tools.c:874
> 874             delete objects;
> (gdb) list
> 869
> 870     void cListBase::Clear(void)
> 871     {
> 872       while (objects) {
> 873             cListObject *object = objects->Next();
> 874             delete objects;
> 875             objects = object;
> 876             }
> 877       objects = lastObject = NULL;
> 878     }
> 
> (gdb) backtrace
> #0  0x0808c831 in Clear__9cListBase (this=0x80c9bec) at tools.c:874
> #1  0x0808c5e7 in _._9cListBase (this=0x80c9bec, __in_chrg=0) at
> tools.c:797
> #2  0x08084ef3 in __static_initialization_and_destruction_0
> (__initialize_p=0,
>     __priority=65535) at remote.c:135
> #3  0x08084f46 in _GLOBAL_.D._7cRemote.in () at remote.c:135
> #4  0x0805ee8a in __do_global_dtors_aux ()
> #5  0x08092439 in _fini ()
> #6  0x400f1456 in exit () from /lib/libc.so.6
> #7  0x400de0cd in __libc_start_main () from /lib/libc.so.6
> 
> It appears that the segfault occurres when the remote control objects
> are destroyed by vdr.
> The plugin remote class is derived from the cRemote class, but it's not
> a vanilla cRemote object.
> The cRemotes class manages a list of cRemote objects.
> I think that the problem occures because of a type conflict: vdr tries
> to destroy an object in the cRemotes list which has a wrong type.
> Could a C++ expert comment on this?
> 
> Oliver
> 
> P.S.: After removing the line 'Remotes.Add(this);' in remote.c,
> the problem disappeared...

Could it be that you delete your cRemote derived object when the program ends?
From PLUGINS.html:

  Note that the object has to be created on the heap (using new),
  and you shall not delete it at any point (it will be deleted automatically
          ********************************
  when the program ends). 

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index