Project

General

Profile

SEGFAULT on Wt::WTableRow

Added by Marcelo Antunes over 4 years ago

I have this class, that extends Wt::WTableRow, and when i run it, it gives-me a segfault on setstyleclass method, on constructor. What is the problem?

.h file:

class MyTableRow : public Wt::WTableRow{
public:
    enum TypeRow{
       //elements of enum
    };

    MyTableRow(TipeRow tipo, MyObject* grupo);
}

.cpp file:

MyTableRow::MyTableRow(TypeRow tipo, MyObject *grupo)
    :Wt::WTableRow(){

    switch (tipo) {
    case Element from  enum:{
        setStyleClass("class1");
        break;
    }

    }
}

regards

Marcelo


Replies (5)

RE: SEGFAULT on Wt::WTableRow - Added by Wim Dumon over 4 years ago

Marcelo,

Do you have a stack trace?

BR,

Wim.

RE: SEGFAULT on Wt::WTableRow - Added by Marcelo Antunes over 4 years ago

Here is a printscreen from the stack (the yellow arrow is where it fails)

stack.png (204 KB) stack.png

RE: SEGFAULT on Wt::WTableRow - Added by Wim Dumon over 4 years ago

Hello,

It looks like WTableRow's constructor does not initialize table_ to null. If you compile Wt from source, please modify WTableRow.C to initialize table_ to null.

A workaround is to add the tablerow to the table before calling setStyleClass() (e.g. by passing it as a parameter to your constructor); calling setTable() directly on tableRow is not possible since that method is private.

Best regards,

Wim.

RE: SEGFAULT on Wt::WTableRow - Added by Marcelo Antunes over 4 years ago

Thanks, it worked.

If possible, correct that on the next release.

regards

Marcelo

RE: SEGFAULT on Wt::WTableRow - Added by Wim Dumon over 4 years ago

Hello Marcelo,

The fix will indeed be in the next release.

Wim.

    (1-5/5)