Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: QT4.2 corrupted double-linked list and QRadioButton existance

  1. #21
    Join Date
    May 2007
    Location
    Warsaw, Poland
    Posts
    52
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    Valgrind?
    I do not know whether it is useful as not long time ago I played with FlowLayout example (QT 4.2) and valgrind gave me:
    Qt Code:
    1. ==6237== LEAK SUMMARY:
    2. ==6237== definitely lost: 88 bytes in 3 blocks.
    3. ==6237== indirectly lost: 120 bytes in 10 blocks.
    4. ==6237== possibly lost: 744 bytes in 3 blocks.
    5. ==6237== still reachable: 322,563 bytes in 4,588 blocks.
    6. ==6237== suppressed: 0 bytes in 0 blocks.
    To copy to clipboard, switch view to plain text mode 

    Now my 1600+ lines application gives me:
    Qt Code:
    1. ==6214== LEAK SUMMARY:
    2. ==6214== definitely lost: 449 bytes in 32 blocks.
    3. ==6214== indirectly lost: 1,526 bytes in 36 blocks.
    4. ==6214== possibly lost: 744 bytes in 3 blocks.
    5. ==6214== still reachable: 331,034 bytes in 4,629 blocks.
    6. ==6214== suppressed: 0 bytes in 0 blocks.
    To copy to clipboard, switch view to plain text mode 

    So I suppose that some of those are because of qt libraries... Am I right?

    Anyway, I may write some parts of valgrind message after checking my application.

  2. #22
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    I don't think this is getting anywhere.
    If the app is only around 1600 lines, then why don't you post it here?
    Would that be possible? Then someone could test it.

    Regards

  3. #23
    Join Date
    May 2007
    Location
    Warsaw, Poland
    Posts
    52
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    Below are links to working application (I have circumvented the problem above) and package of code files and file containing some data to test program (one humble *.dat file).

    Anyway, I would be glad if someone experienced checked some of my code for bugs and bad habits. I know it is difficult to ask you for such thing but marcel suggested such a solution himself.

    The "funny" thing is when I de-comment code connected to QTranslator in main.cpp I get SIGSEV gift.
    In other words I cannot translate my application using .ts file made by Linguist.

    So my inference is that there is some crucial memory management bug in MY code that sometimes throws irrational SIGSEV, blocking me of using certain normal ways of programming.

    I just cannot find it!

    Program and code package in:
    http://www.mjakobczyk.pl/pub/code/

  4. #24
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    I compiled your application( on Windows, Qt 4.3 ) but I cannot get it to crash( I uncommented the translator lines in main).
    Could you say what steps are involved?

    Regards

  5. #25
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    Here's at least one issue that prevents it from launching for me:
    Qt Code:
    1. void MWin::initialization(void) {
    2. ...
    3. tableViewWidget = new MyMVC(list); // list is yet uninitialized
    4. ...
    5. list = new QList<MTR::Book>; // it's being initialized somewhere here afterwards
    6. ...
    7. }
    To copy to clipboard, switch view to plain text mode 
    I would suggest allocating QList objects on the stack and passing them as references. Allocating them on the heap is more error prone. QList is an implicitly shared class so unmodified copies are cheap.
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    mtrpoland (21st July 2007)

  7. #26
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    Yeah, that and correct the following from:
    Qt Code:
    1. namespace MTR {
    2. class Book;
    3. class SBook;
    4. }
    To copy to clipboard, switch view to plain text mode 

    to:
    Qt Code:
    1. namespace MTR {
    2. class Book;
    3. struct SBook;
    4. }
    To copy to clipboard, switch view to plain text mode 

    I was getting a few warnings and a linker error because of this.

    Regards

  8. The following user says thank you to marcel for this useful post:

    mtrpoland (21st July 2007)

  9. #27
    Join Date
    May 2007
    Location
    Warsaw, Poland
    Posts
    52
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4.2 corrupted double-linked list and QRadioButton existance

    Gentlemen, now all indeed does work. A nod of respect. Thank you very much. Now I see that the key was what highlighted jpn. It destabilized my application.

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.