The exception is not generated by a lexical_cast that I do on my code, but by WT converting some (bad) data I send. This exception is generated when i use a custom WItemDelegate, I create it like this :

        mtableView->setItemDelegateForColumn(3,  new  
WidgetCustomItemDelegate(this));


The update function of my own WItemItemDelegate look like this :

---------------------------------------
Wt::WWidget*WidgetCustomItemDelegate::update(Wt::WWidget*widget,constWt::WModelIndex&index,Wt::WFlags<Wt::ViewItemRenderFlag>flags)

{

    WString  path;

    WString  displayRole;

    if  (  index.data(UserRole).type()  ==  typeid(WString))

    {

        path  =  boost::any_cast<WString>(index.data(UserRole));

    }

    if  (  index.data(DisplayRole).type()  ==  typeid(WString))

    {

        displayRole  =  boost::any_cast<WString>(index.data(DisplayRole));

    }

    bool  isNew  =  false;

    if  (!(flags  &  RenderEditing))

    {

        if  (!widget)

        {

            isNew  =  true;

            Wt::WText  *  text  =  new  Wt::WText();

            Wt::WContainerWidget  *  container  =  new  Wt::WContainerWidget();

            Wt::WHBoxLayout  *  layout  =  new  Wt::WHBoxLayout();

            layout->setContentsMargins(2,4,2,6);

            container->setLayout(layout);

            layout->addWidget(text);

            container->setObjectName("container");

            text->setText(displayRole);

            text->setToolTip(path);

            text->clicked().connect(this,  &WidgetCustomItemDelegate::clicked);

            widget  =  container;

        }

        if  (!index.isValid())

            return  widget;

        Wt::WContainerWidget  *  container  =  dynamic_cast<Wt::WContainerWidget  
*>(widget->find("container"));

        if  (container)

        {

            Wt::WText  *  text  =  dynamic_cast<Wt::WText  
*>(container->widget(0));

            if  (text)

            {

                text->setText(displayRole);

                text->setToolTip(path);

            }

        }

    }

    return  widget;
}
--------------------------------

Is there anything wrong with this update function ? I tried to look the Wt way 
to use WItemDelegate cause I didn't understand how it should be used.
( I need this item delegate to be able to connect a click event on a tableView 
item. )



Le 14/10/2011 19:32, Mohammed Rashad a écrit :
please post the code which contains boost::lexical_cast<>
you may be converting fundamental datatypes such string to int or something like that

On Fri, Oct 14, 2011 at 5:57 PM, Koen Deforche <k...@emweb.be <mailto:k...@emweb.be>> wrote:

    Hey Bastien,

    2011/10/14 Bastien AMIEL <bastien.am...@opencubetech.com
    <mailto:bastien.am...@opencubetech.com>>:
    > Hi,
    >
    > I get a crash (that reset the current session) while i'm using
    WTableView
    > with some Custom WItemDelegate.
    > The crash does not come as soon as I open the page, it happens
    after some
    > elements are deleted and added to a different WTableView.
    > I do not use InternalPath.
    > I display UTF8 characters.
    >
    > I get this log :
    >
    > [error] "Error during event handling: bad lexical cast: source
    type value
    > could not be interpreted as target"
    > [fatal] "bad lexical cast: source type value could not be
    interpreted as
    > target"
    > [notice] "Session destroyed (#sessions = 0)"
    >
    >
    > Any idea of what could cause this kind of problem ?

    I would try to find out by breaking on an exception being thrown (in
    gdb: catch throw) and then see what happens ?

    boost::lexical_cast<> is used all over the place, so it's a bit hard
    to guess where it comes from.

    Regards,
    koen

    
------------------------------------------------------------------------------
    All the data continuously generated in your IT infrastructure
    contains a
    definitive record of customers, application performance, security
    threats, fraudulent activity and more. Splunk takes this data and
    makes
    sense of it. Business sense. IT sense. Common sense.
    http://p.sf.net/sfu/splunk-d2d-oct
    _______________________________________________
    witty-interest mailing list
    witty-interest@lists.sourceforge.net
    <mailto:witty-interest@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/witty-interest




--
Regards,
   Mohammed Rashad K M
   M.S. (By Research) student
   Lab for Spatial Informatics
   Department of CSE
   International Institute of Information Technology
   Hyderabad, India



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct


_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to