Bug #1168
closeddeleting const refrence pointer
0%
Description
in WWebWidget.C we have:
<code class="cpp">
void WWebWidget::setDecorationStyle(const WCssDecorationStyle& style)
{
#ifndef WT_TARGET_JAVA
decorationStyle() = style;
#else
if (!lookImpl_)
lookImpl_ = new LookImpl();
lookImpl_->decorationStyle_ = &style;//assign pointer to pointer of const reference
#endif // WT_TARGET_JAVA
}
</code>
in LookImpl destruct
<code>
WWebWidget::LookImpl::~LookImpl()
{
delete decorationStyle_;//delete pointer,(maybe dynamically allocated, or pointer to const reference which is not allowed)
delete toolTip_;
}
</code>
Updated by Koen Deforche almost 13 years ago
- Status changed from New to Resolved
Hey Omar,
Are you seeing this bug in real code ?
The code path which takes the pointer is only for our Java "port" (#ifdef WT_TARGET_JAVA), and thus only ends up in JWt, which has a totally different memory model: in Java we simply copy the pointer, but in C we copy the entire object.
Regards,
koen
Updated by omair geetan almost 13 years ago
ok i didnt notice the #ifndef
but im also java developper
how would you use bitwise (and) operator (&) in java as (address of) operator(&) in c/c
in this statement:
lookImpl_->decorationStyle_ = &style;
//this is must be wrong java statement unless you replace all & with empty space ,as some preprocessing method you do to generate java code
Updated by Wim Dumon almost 13 years ago
Hello Omair,
Our C to Java translator is more complex than what you can achieve with a super-regexp. It does a semantic analysis of the code and writes out correct Java.
Wim.
Updated by Koen Deforche over 12 years ago
- Status changed from Resolved to Closed
- Target version set to 3.2.1