Results 1 to 5 of 5

Thread: Anyone an idea why this code segfaults?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: Anyone an idea why this code segfaults?

    Quote Originally Posted by wysota View Post
    The general problem is that you try to modify an object which is passed as an argument of a signal and if there are more than one slots connected to that signal, the second (and consecutive) slots may be called for invalid data. That's why you should avoid situations where you delete the signal argument from inside a slot. You can overcome the problem by moving the deletion to after all slots have been fired (for example use a single shot timer with 0 timeout that will perform the actual delete).
    Nope, this is not the problem. No passed object to a slot. In a context menu event a QAction is created, which calls a method 'deleteSelected()'. deleteSelected() has a pointer to the model, fetches the selected indices from that model and starts to delete. No signal/slot or passed parameter involved at all.

    I think the QPersistentModel hint was the right idea.

    QPersistenModel was definitely the right idea. Problem solved.
    Last edited by Kumosan; 28th April 2007 at 06:20. Reason: updated contents

Similar Threads

  1. Pasting code from code tag in emacs
    By Gopala Krishna in forum General Discussion
    Replies: 0
    Last Post: 16th February 2007, 05:47
  2. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  3. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  4. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

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.