Results 1 to 8 of 8

Thread: Handle QContextMenuEvent conflict

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Handle QContextMenuEvent conflict

    No, I don't use thread. You can see the code of my control at this link http://www.qtcentre.org/threads/40744-Hierarchical-TreeView?highlight=

    Thanks for your help

    Michele

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

    Default Re: Handle QContextMenuEvent conflict

    See if these asserts fire:
    Qt Code:
    1. void TableDelegate::setHideColumn(int column)
    2. {
    3. Q_ASSERT(column < 30);
    4. colshided[column]=1;
    5. }
    6.  
    7. void TableDelegate::setShowColumn(int column)
    8. {
    9. Q_ASSERT(column < 30);
    10. colshided[column]=0;
    11. }
    12.  
    13. void InternalTableDelegate::setHideColumn(int column)
    14. {
    15. Q_ASSERT(column < 30);
    16. colshided[column]=1;
    17. }
    18.  
    19. void InternalTableDelegate::setShowColumn(int column)
    20. {
    21. Q_ASSERT(column < 30);
    22. colshided[column]=0;
    23. }
    To copy to clipboard, switch view to plain text mode 
    ==========================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
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Handle QContextMenuEvent conflict

    Dear high_flyer,
    I added your code to the mine, and I isolated the HGrid component to the other software, creating a new small project that I attach.
    If I request the context menu (in release mode or run debug mode) rapidly to the different QTreeView (outher and inner) and click onto the menu appared, after some click I obtain the "errore.png" window, I think relative to one of Q_Assert that I inserted. To know which of the 4 assert rised, i try to click "Debug with QTCreator" but I got the "nodebug.png" error dialog.
    Other time, I got the "QMutex..." error that I post in previous posts yet, with "errQMutex.png" error dialog.

    What else I should check?

    Thanks a lot for your time.

    Michele
    Attached Images Attached Images
    Attached Files Attached Files

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

    Default Re: Handle QContextMenuEvent conflict

    I think relative to one of Q_Assert that I inserted.
    If the assert is caught, the message will contain the file and line number of the assert which caused the break.

    Since you made a test project, and since it is crashing, just run it in a debugger, and see which line is crashing.

    As I said in my first post, it looks like you are writing out of bounds, probably to your int array.
    So have a look in your code to all the places where you reference that array, and make sure you surround that code with a check, so that you don't reference it outside its bounds.
    ==========================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
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Handle QContextMenuEvent conflict

    Thansk a lot high_flyer, but... which debugger? If I run my project by "Start debugging (F5)" from QTCreator, it no crash! How can I see the line code?
    In one run of start debugging, it wrote:
    Heap corruption detected at 00B33388
    Heap corruption detected at 00B33388
    Heap [hierarchical.exe]:
    Heap: Free heap block b33380 modified at b33390 after it was freed.

    ..... exited with code 1073807364
    Is there any other then I should check?

    Thanks a lot for your time.

    I'll check my code on that array

    thanks.

    Michele

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

    Default Re: Handle QContextMenuEvent conflict

    Ok, the problem as the debugger is saying, is a heap corruption, not a stack.
    You are either reallocating memory on pointer that you haven't freed AND/OR doing some pointer arithmetic which is corrupting the pointer.
    Make sure you free all the pointers you are allocating on the heap, and test the pointer for validity before using it.
    Setting pointers to NULL when ever not initialized is recommended as well.
    ==========================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.

Similar Threads

  1. Replies: 1
    Last Post: 22nd February 2011, 23:54
  2. Replies: 0
    Last Post: 20th January 2010, 20:51
  3. MinGW conflict?
    By Paolo_R in forum Newbie
    Replies: 3
    Last Post: 30th June 2009, 06:16
  4. QContextMenuEvent appear on mouse release
    By bucksey in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2009, 02:09
  5. Framebuffer conflict
    By Vidar Bøe in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 21st November 2008, 11:33

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
  •  
Qt is a trademark of The Qt Company.