Results 1 to 4 of 4

Thread: QString::operator=(QString &) problem, after moving some functionality to so lib

  1. #1
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default QString::operator=(QString &) problem, after moving some functionality to so lib

    Hi again,

    Recently I have created my own library (dynamically linked, Linux controlled os) and managed to successfully linked my application to it.
    Sadly I encountered a problem that in previous version (in which classes located now in library, where in application code). Where is the problem ?

    Here is the code snippet which generates SIGSEGV exception.
    Qt Code:
    1. void WorkerQuery::worker_mode(const QSqlRecord& rec) {
    2. w = new Worker(selfPointer);
    3. w->setPrimaryKey(rec.value("idWorker").toInt());
    4. w->setNames(rec.value("fname").toString(),rec.value("lname").toString()); //PROBLEM HERE
    5. w->setLogin(rec.value("login").toString()); //PROBLEM ALSO HERE
    6. w->setPriviliges(rec.value("authorization").toString()); //BUT THIS LINE GENERATES NO ERROR
    7. }
    To copy to clipboard, switch view to plain text mode 

    QtCreator right after it's caught the exception is moving me to Dissambler, where I can see disassembled operator= from QString library and debugger is pointing at
    Qt Code:
    1. 0x7ffff6921e50 <+032>: lock decl (%rax)
    To copy to clipboard, switch view to plain text mode 
    this instruction

    One more thing...
    here are declarations of the method setNames and setLogin
    Qt Code:
    1. void setLogin(const QString &login);
    2. void setNames(const QString &a,const QString &b);
    3. void setPriviliges(const QString &c);
    To copy to clipboard, switch view to plain text mode 

    What is more interesting is that only setLogin, setNames generates exception but setPriviliges generates no error still having same declarations as for example setLogin.
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

  2. #2
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QString::operator=(QString &) problem, after moving some functionality to so lib

    I found out that the same problem occurs under Windows...
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QString::operator=(QString &) problem, after moving some functionality to so lib

    What does the code inside those three functions look like?
    What does the stack backtrace look like?
    Are you sure that rec is valid and does it have columns called "fname", "lname" and "login"?
    Last edited by ChrisW67; 13th February 2012 at 03:29.

  4. #4
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QString::operator=(QString &) problem, after moving some functionality to so lib

    These questions are now irrelevant, however rec was valid, the problem was somewhere else, where I did not except it to come up.
    I'd simply forgotten to properly create private objects in dll, so despite valid access to Worker object, this object itself was encountering the problem when accessing to private members via d_ptr...

    so there is everything fine with QString and it was due to my neglect....
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

Similar Threads

  1. Replies: 2
    Last Post: 11th August 2011, 15:42
  2. QString operator+= strange behaviour
    By babu198649 in forum Newbie
    Replies: 13
    Last Post: 17th January 2010, 05:54
  3. Replies: 4
    Last Post: 31st January 2008, 20:44
  4. QString == Operator
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 27th December 2006, 17:08
  5. operator<< QString
    By kiker99 in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2006, 00:23

Tags for this Thread

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.