Results 1 to 20 of 25

Thread: Interesting little Segfault w/r to signal/slot connection

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    kingston.on.ca
    Posts
    17
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Interesting little Segfault w/r to signal/slot connection

    Good Afternoon

    I've got an interesting little segfault that I can't seem to figure out why it's happening.

    This is using Qt 4.1.0 I beleive.

    First of all, here's a dump of the backtrace:

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -150056832 (LWP 3712)]
    0x00f14c67 in QObject::connect (sender=0x8461ea0, signal=0x805c630 "2currentItemChanged( QTableWidgetItem *, QTableWidgetItem * )", receiver=0x83f3688,
    method=0x805c5fc "1validate( QTableWidgetItem *, QTableWidgetItem * )", type=AutoConnection) at kernel/qobject.cpp:2134
    2134 kernel/qobject.cpp: No such file or directory.
    in kernel/qobject.cpp
    (gdb) bt
    #0 0x00f14c67 in QObject::connect (sender=0x8461ea0, signal=0x805c630 "2currentItemChanged( QTableWidgetItem *, QTableWidgetItem * )", receiver=0x83f3688,
    method=0x805c5fc "1validate( QTableWidgetItem *, QTableWidgetItem * )", type=AutoConnection) at kernel/qobject.cpp:2134
    #1 0x080563a4 in DataGen::setUpConnections (this=0x83f3688) at datagen.cpp:553
    #2 0x0804d480 in DataGen (this=0x83f3688) at datagen.cpp:45
    #3 0x08057d73 in main (argc=1, argv=0xfef1b434) at main.cpp:12
    At first glance, it seems that the signal slot connection is having a hard time being made. The file not found error seems to point to something wrong with the Qt install, but here's the kicker, the exact same code runs perfectly fine in another project I have, on the same machine no less. So I'm not sure that the Qt install is the problem.

    The code that seems to be closest to causing this fault is in the setUpConnections function, relevent snippet is here:
    Qt Code:
    1. void DataGen::setUpConnections()
    2. {
    3. //Signals and Slot Connections.
    4. //This line is causing the problem, although it's syntactically and semantically correct...at least it seems to be.
    5. connect( m_munPhRanges, SIGNAL( currentItemChanged( QTableWidgetItem *, QTableWidgetItem * ) ),
    6. this, SLOT( validate( QTableWidgetItem *, QTableWidgetItem * ) ) );
    7. connect( m_munPkRanges, SIGNAL( currentItemChanged( QTableWidgetItem *, QTableWidgetItem * ) ),
    8. this, SLOT( validate( QTableWidgetItem *, QTableWidgetItem * ) ) );
    9. ...
    10. }
    To copy to clipboard, switch view to plain text mode 

    The validate function prototype is as follows:
    Qt Code:
    1. /**
    2.  * @brief Slot used to validate the entries in a table. Called when a cell is finished editing,
    3.  * will turn the cell background red in the event of an invalid input. Values inported from file are assumed to be correct.
    4.  * @param current Pointer to the TableWidgetItem in the current cell (not used, required by the signal).
    5.  * @param previous Pointer to the previously edited TableWidgetItem.
    6.  */
    7. void validate( QTableWidgetItem * current, QTableWidgetItem * previous );
    To copy to clipboard, switch view to plain text mode 

    If there's anything else you guys need, I'll try to see what I can do.

    Thanks.
    Last edited by jacek; 11th September 2006 at 21:30. Reason: reformatted to look better

Similar Threads

  1. Interesting tutorial on UI Designer
    By GreyGeek in forum Qt Tools
    Replies: 1
    Last Post: 6th August 2006, 08:43
  2. segfault
    By conexion2000 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2006, 12:34
  3. Why does setTextColor() cause a segfault?
    By johnny_sparx in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2006, 16:58
  4. Replies: 10
    Last Post: 10th February 2006, 00:15
  5. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 11:24

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.