Hey Rutger,
Since Wt does not tie threads to sessions (that wouldn't scale), it cannot
keep stacks alive in between requests, and thus there is no practical way
to use stack-allocated widgets in Wt (except for, as Dmitriy suggested,
when you do block the stack with e.g. WDialog::exec() in a recursive
eventloop, but this is not recommended since it breaks your application
scalability).
How would you envision to keep widgets allocated on the stack?
Regards,
koen
2013/6/13 Rutger ter Borg <rut...@terborg.net>
>
> On 2013-06-13 13:04, Dmitriy Igrishin wrote:
> >
> > While it's possible, it seems to me, that this coding technique is just
> > asking for troubles. Wt has a pointer semantics and heavily oriented to
> > the abstract classes design. There are a lot of allocations under the
> hood
> > of Wt, so I don't believe in a benefit of stack-allocated objects
> (except of
> > WDialog and similar instances in case of blocking the thread awaitng for
> the
> > user response).
> >
>
>
> Well, it saves typing :-). More seriously though, I prefer to going
> trough some trouble now and ending up with a full understanding over not
> worrying and hoping for the best.
>
>
> >
> > Yes, because WMenuItem is owns contents. WMenuItem needs to be
> > an owner of contents while the content's ownership may be transferred to
> > the contents stack after the actual loading.
> > On the other hand, the content that was not reowned must be deleted
> > by the WMenuItem.
>
> The issue was solved by making the content widgets heap allocated and
> marking their ownership as transferred.
>
> Cheers,
>
> Rutger
>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest