Project

General

Profile

Actions

Bug #1168

closed

deleting const refrence pointer

Added by omair geetan about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
02/17/2012
Due date:
% Done:

0%

Estimated time:

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>
Actions #1

Updated by Koen Deforche about 12 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

Actions #2

Updated by omair geetan about 12 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

Actions #3

Updated by Wim Dumon about 12 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.

Actions #4

Updated by Koen Deforche almost 12 years ago

  • Status changed from Resolved to Closed
  • Target version set to 3.2.1
Actions

Also available in: Atom PDF