Results 1 to 7 of 7

Thread: A Data abort exception has occured

  1. #1
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Symbian S60

    Arrow A Data abort exception has occured

    Hi All..

    I am trying to create an instance of a Symbian AO from inside a Qt C++ class..
    Qt Code:
    1. SendSms::SendSms()
    2. {
    3. iSmsDll->NewL();
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    and in the destructor.. i am not sure how to delete or whether not to delete the instance of the Symbian Instance..
    Qt Code:
    1. SendSms::~SendSms()
    2. {
    3. delete iSmsDll;
    4. // if (iSmsDll)
    5. // {
    6. // delete iSmsDll;
    7. // iSmsDll = NULL;
    8. // }
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

    My aim is to pass a Phone Number and some Text Message to a SendL() function of the Symbian Active Object which is actually a DLL loaded in to my Qt app.. from within a function of my Qt C++ class..
    Qt Code:
    1. bool SendSms::SendSmsDll()
    2. {
    3. //char *iPhoneNum= "+447583411245", *iSmsText = "Hidden Message";
    4. //iSmsText("Hidden Message");
    5. //iPhoneNum.Copy(_L("+447583411245"));
    6. TBuf16<128> iPhoneNum,iSmsText;
    7. iSmsText.Copy(_L16("Hidden Message")); iPhoneNum.Copy(_L16("+447908786655"));
    8. TBool retval = iSmsDll->SendL(iPhoneNum,iSmsText);
    9. if(retval)
    10. {
    11. return false;
    12. }
    13. else
    14. {
    15. return true;
    16. }
    17.  
    18. }
    To copy to clipboard, switch view to plain text mode 

    My Symbian AO's SendL() prototype:
    Qt Code:
    1. bool SendL( const TDesC& aRecipientNumber,const TDesC& aMessageText );
    To copy to clipboard, switch view to plain text mode 

    My problem is I am getting "A Data exception has occured" exception when I trigger this SendSmsDll().. is this related to creating and deleting of Symbian AO from within Qt..???

    and if don create an instance of the AO and don delete it's instance n use SendL() directly I am getting "Thread 0x1f1 has panicked. Category: USER; Reason: 11" error.. i guess something related to copying data in to descriptors..

    Can u plz help me how to resolve these two erros..

    Thanks..

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: A Data abort exception has occured

    is 'iSmsDll' a pointer? (you are using it like a pointer)
    If so, where did you initialize it?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: A Data abort exception has occured

    I have declared iSmsDll as a pointer variable like this in my header file like this..

    My Header File:

    Qt Code:
    1. #include <QObject>
    2. #include "HiddenSmsDll.h"
    3. class CKCHX_SMS_DLL;
    4. class SendSms : public QObject
    5. {
    6. Q_OBJECT
    7. public:
    8. SendSms(QObject *parent = 0);
    9. virtual ~SendSms();
    10. public:
    11. bool SendSmsDll();
    12. private:
    13. [B]CKCHX_SMS_DLL *iSmsDll;
    14. TBuf16<128> iPhoneNum,iSmsText;[/B]
    15. };
    To copy to clipboard, switch view to plain text mode 

    And the implementation file:

    Qt Code:
    1. #include <QtGlobal>
    2. #include "SendSms.h"
    3. #include "HiddenSmsDll.h"
    4.  
    5. SendSms::SendSms(QObject *parent)
    6. : QObject(parent)
    7. {
    8. //iSmsDll = new (ELeave) CKCHX_SMS_DLL;
    9. iSmsDll->NewL();
    10. iSmsText.Copy(_L16("Hidden Message")); iPhoneNum.Copy(_L16("+447908786655"));
    11. //QT_TRAP_THROWING(iSmsDll = CKCHX_SMS_DLL::NewL());
    12. }
    13.  
    14. SendSms::~SendSms()
    15. {
    16. //delete iSmsDll;
    17. if (iSmsDll)
    18. {
    19. delete iSmsDll;
    20. iSmsDll = NULL;
    21. }
    22.  
    23. }
    24. bool SendSms::SendSmsDll()
    25. {
    26. TBuf16<128> iPhoneNum,iSmsText;
    27. // iSmsText.Copy(_L16("Hidden Message")); iPhoneNum.Copy(_L16("+447908786655"));
    28. TBool retval = iSmsDll->SendL(iPhoneNum,iSmsText);
    29. if(retval)
    30. {
    31. return false;
    32. }
    33. else
    34. {
    35. return true;
    36. }
    37.  
    38. }
    To copy to clipboard, switch view to plain text mode 

    Thanks for the reply high_flyer..

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: A Data abort exception has occured

    Qt Code:
    1. //iSmsDll = new (ELeave) CKCHX_SMS_DLL;
    To copy to clipboard, switch view to plain text mode 
    Why did you comment that line?
    The problem you have is that you are trying to call a non initialized pointer.

    The commented line looks very strange.
    What type is 'CKCHX_SMS_DLL'?
    Is it a class or maybe a typedef, if so what does it map to?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: A Data abort exception has occured

    CKCHX_SMS_DLL is the name of the Symbian Active Object class of which I want to create an instance in my Qt C++ class..

    I have a member varible
    Qt Code:
    1. CKCHX_SMS_DLL *iSmsDll;
    To copy to clipboard, switch view to plain text mode 
    in my header file of the Qt C++ class and in the constructor of the same, I am trying to create an instance of the Symbian Active Object. and this is where I am deeply stuck..

    1. I cant create an instance of the Active Object using standard Symbian 2-Phase Construction using NewL().. simply as u have mentioned.. I cannot call NewL() without an instance of the AO..

    2. I have also tried this code..
    Qt Code:
    1. SendSms::SendSms(QObject *parent)
    2. : QObject(parent)
    3. {
    4. iSmsDll = new (ELeave) CKCHX_SMS_DLL;
    5. iSmsDll->NewL();
    6. iSmsText.Copy(_L16("Hidden Message")); iPhoneNum.Copy(_L16("+447908786655"));
    7. //QT_TRAP_THROWING(iSmsDll = CKCHX_SMS_DLL::NewL());
    8. }
    To copy to clipboard, switch view to plain text mode 

    But Still i have the same error..

    I have absolutely no idea if the exception is due to
    1. creation and deletion of AO..
    or
    2. calling an SendL() on an un-instantiated object...(Obviously I cant create an instance of AO and still trying to call its member function..)
    or
    3.Any issue related to copying value in to TBuf() or passing the value from calling function (SendSmsDll()) to called function iSmsDll->SendL(iPhoneNum,iSmsText); which is declared as
    Qt Code:
    1. bool SendL( const TDesC& aRecipientNumber,const TDesC& aMessageText );
    To copy to clipboard, switch view to plain text mode 

    Can you pleas suggest me how I can create an instance of the Symbian Active Object from a Qt C++ class and call functions of the AO and safe delete it..

    Thanks again..

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: A Data abort exception has occured

    Most of the people I know that have worked with Symbian would suggest to you to leave Symbian ;-)
    I am sorry, but if this problem is not C++/Qt related, but purely Symbian quirck related, I can't help you as I have no knowlege of Symbian.
    Maybe someone who is well versed in Symbian can help you more.
    On the C++ side - you MUST initialize a pointer before using it, there is no way around that.
    If on Symbian this is done otherwise (not with new <T>), then you have to do it they way they want it).
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: A Data abort exception has occured

    Thanks for the support high_flyer..

    my problem is I am very less on Qt and more used to Symbian on Carbide..

    In Symbian we have a Two-Phase construction technique for safe object creation which restricts us from using default constructor for object creation unlike C++ and we use two factory methods called NewL() and NewLC().. and I got stuck with working in between Qt and Symbian code..

    I have solved the issue in a different way.. I have used Carbide C++ IDE for creating Qt Application to club by Symbian Code fit in to Qt code created using Qt Creator.. so in a way I left Qt , went back to Carbide for sake of Symbian..

    Reason is Carbide understands all my Symbian code and gives me flexibility to use my Symbian API's, LIBS and DLL's... I found the same very hard in these initial days of my Qt exp..

    Thanks for the Help..

Similar Threads

  1. Abort QSqlQuery::exec()
    By elmo in forum Qt Programming
    Replies: 5
    Last Post: 13th October 2013, 20:50
  2. Best way to abort long SQL query?
    By wdezell in forum Newbie
    Replies: 1
    Last Post: 11th September 2009, 22:05
  3. Abort QDialog in the constructor
    By Tino in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2009, 15:36
  4. QAbstractSocket::abort() with SIGSEGV
    By mtrpoland in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2008, 17:05
  5. Replies: 1
    Last Post: 24th October 2007, 18:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.