[Kde-pim] Segment fault tring to create akonadi resource in

Kevin Krammer kevin.krammer at gmx.at
Wed Aug 17 11:24:31 BST 2011


On Wednesday, 2011-08-17, Mario Santagiuliana wrote:
> > Most likely unrelated to the crash but definitely wrong is passing a
> > hard coded identifier. The identifier is handed out by the Akonadi
> > Control process, passed to the resource as a commandline parameter (see
> > the --identifier part of the commandline of other resources running on
> > your system).
> > 
> > > If you want I can provide a little backtrace...
> > 
> > Can't hurt.
> > 
> > Cheers,
> > Kevin
> 
> Thank you Kevin for your answer.
> I read this email:
> http://markmail.org/message/o7ox54axggec564q
> 
> I create another test python file in attachment. I add the identifier
> option like Ignacio code.
> I run gdb and in attachment the log with backtrace.
> 
> I don't understand if the akonadi.resourcebase object call is correct...If
> the script is ok to start write an akonadi resource using python or it is a
> bug in pykde...

I think the problem is that you are missing the QApplication instance, 
basically the first thing any Qt or KDE application creates in main.

The main() function in C++ works a bit like this (simplified, the original 
uses templates):

int main( int argc, char **argv )
{
      const QString id = parseArguments( argc, argv );
      KApplication app;
      ResourceClass* r = new ResourceClass( id );

      // check if ResourceClass also inherits AgentBase::Observer and
      // if it does, automatically register it on itself
      Observer *observer = dynamic_cast<Observer*>( r );
      if ( observer != 0 )
        r->registerObserver( observer );

      return init( r );
}

So you could try the PyKDE equivalent of
KApplication app;
before creating the instance of your resource class.

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110817/4b692310/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list