Project

General

Profile

Actions

Bug #948

closed

setBorder(WBorder border, WFlags<Side> sides = All)

Added by Zhimin Song about 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
08/12/2011
Due date:
% Done:

0%

Estimated time:

Description

hey, Wt group:

I want to apply a concise style on a table like below:

    void StatisticTable::applyConciseStyle(bool last_row_border) {

        int row_c = table_->rowCount();
        int col_c = table_->columnCount();

        WBorder main_b;
        main_b.setWidth(WBorder::Explicit, WLength(2));
        main_b.setStyle(WBorder::Solid);
        main_b.setColor(WColor("green"));

        WBorder sub_b;
        sub_b.setWidth(WBorder::Explicit, WLength(1));
        sub_b.setStyle(WBorder::Solid);
        sub_b.setColor(WColor("green"));

        for(int tcol = 0; tcol < col_c; ++tcol) {
            table_->elementAt(0, tcol)->decorationStyle().setBorder(main_b, Top);
            table_->elementAt(1, tcol)->decorationStyle().setBorder(sub_b, Top);
            if(last_row_border)
                table_->elementAt(row_c-2, tcol)->decorationStyle().setBorder(sub_b, Bottom);
            table_->elementAt(row_c-1, tcol)->decorationStyle().setBorder(main_b, Bottom);
        }

, but the grind reported below:

==6828== Thread 8:
==6828== Invalid read of size 4
==6828==    at 0x41F8A50: Wt::WBorder::cssText() const (WBorder.C:60)
==6828==    by 0x422A3E3: Wt::WCssDecorationStyle::updateDomElement(Wt::DomElement&, bool) (WCssDecorationStyle.C:270)
==6828==    by 0x43B3D1A: Wt::WWebWidget::updateDom(Wt::DomElement&, bool) (WWebWidget.C:1348)
==6828==    by 0x42A01AB: Wt::WInteractWidget::updateDom(Wt::DomElement&, bool) (WInteractWidget.C:325)
==6828==    by 0x42270CE: Wt::WContainerWidget::updateDom(Wt::DomElement&, bool) (WContainerWidget.C:520)
==6828==    by 0x434E657: Wt::WTableCell::updateDom(Wt::DomElement&, bool) (WTableCell.C:96)
==6828==    by 0x43B0EDB: Wt::WWebWidget::createDomElement(Wt::WApplication*) (WWebWidget.C:1780)
==6828==    by 0x422613F: Wt::WContainerWidget::createDomElement(Wt::WApplication*, bool) (WContainerWidget.C:651)
==6828==    by 0x422619B: Wt::WContainerWidget::createDomElement(Wt::WApplication*) (WContainerWidget.C:642)
==6828==    by 0x43AC29E: Wt::WWebWidget::createActualElement(Wt::WApplication*) (WWebWidget.C:1823)
==6828==    by 0x43C826C: Wt::WWidget::createSDomElement(Wt::WApplication*) (WWidget.C:316)
==6828==    by 0x434C4C8: Wt::WTable::createRow(int, bool, Wt::WApplication*) (WTable.C:327)
==6828==  Address 0x30 is not stack'd, malloc'd or (recently) free'd
==6828== 
==6828== Process terminating with default action of signal 11 (SIGSEGV)
==6828==  Access not within mapped region at address 0x30
==6828==    at 0x41F8A50: Wt::WBorder::cssText() const (WBorder.C:60)
==6828==    by 0x422A3E3: Wt::WCssDecorationStyle::updateDomElement(Wt::DomElement&, bool) (WCssDecorationStyle.C:270)
==6828==    by 0x43B3D1A: Wt::WWebWidget::updateDom(Wt::DomElement&, bool) (WWebWidget.C:1348)
==6828==    by 0x42A01AB: Wt::WInteractWidget::updateDom(Wt::DomElement&, bool) (WInteractWidget.C:325)
==6828==    by 0x42270CE: Wt::WContainerWidget::updateDom(Wt::DomElement&, bool) (WContainerWidget.C:520)
==6828==    by 0x434E657: Wt::WTableCell::updateDom(Wt::DomElement&, bool) (WTableCell.C:96)
==6828==    by 0x43B0EDB: Wt::WWebWidget::createDomElement(Wt::WApplication*) (WWebWidget.C:1780)
==6828==    by 0x422613F: Wt::WContainerWidget::createDomElement(Wt::WApplication*, bool) (WContainerWidget.C:651)
==6828==    by 0x422619B: Wt::WContainerWidget::createDomElement(Wt::WApplication*) (WContainerWidget.C:642)
==6828==    by 0x43AC29E: Wt::WWebWidget::createActualElement(Wt::WApplication*) (WWebWidget.C:1823)
==6828==    by 0x43C826C: Wt::WWidget::createSDomElement(Wt::WApplication*) (WWidget.C:316)
==6828==    by 0x434C4C8: Wt::WTable::createRow(int, bool, Wt::WApplication*) (WTable.C:327)

I changed some code like below, every thing is ok:

            if(last_row_border)
                table_->elementAt(row_c-1, tcol)->decorationStyle().setBorder(sub_b, Top);
            table_->elementAt(row_c, tcol)->decorationStyle().setBorder(main_b, Top);

I think whether the setBorder(WBorder border, WFlags sides = All) does not work? it is fine in wt-3.1.9, in wt-3.1.10 I must change the setBorder(main_b, Bottom) to setBorder(main_b, Top).

Thanks

Best Regards

Zhimin

Actions #1

Updated by Koen Deforche about 12 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.1.11

Hey Zhimin,

There was a typo in indeed a recently changed WCssDecorationStyle.

The fix will be in the public repo later today.

Regards,

koen

Actions #2

Updated by Koen Deforche about 12 years ago

  • Status changed from Resolved to Closed

Resolved in Wt 3.1.11

Actions

Also available in: Atom PDF