Opened 10 years ago

Closed 10 years ago

#317 closed defect (fixed)

Smart pointer methods in ptr.h throw nothing

Reported by: hugueswski Owned by: BruceDechant
Priority: high Milestone: 2.1
Component: Server Version: 2.0.0
Severity: critical Keywords:
Cc: External ID: 1075218

Description

The throw of nothing is causing some problems in a sevral methods, like this one:

#ifdef _WIN32

T operator&() throw(...)

#else

T operator&()

#endif

{

if (p!=NULL)

throw; ::Create(MgException::NLSGetMessage(_NLSID(_2_BADPARAMETER)));

return &p;

}

Notice that the throw statements are actually rethrow statements - these can't be caught by any catch statement. Here is a little test app showing that you can't catch this kind of throw statement even with catch(…). You always crash with an unhandled exception.

void f() throw(...) {

throw;

}

int main(int, char ) {

try {

f();

} catch(...) {

::std::cerr << "Caught an exception" << ::std::endl;

} return 1;

}

Change History (4)

comment:1 Changed 10 years ago by hugueswski

External ID: 1048731
Priority: mediumhigh
Severity: majorcritical

comment:2 Changed 10 years ago by hugueswski

External ID: 10487311075218

comment:3 Changed 10 years ago by BruceDechant

Owner: set to BruceDechant
Status: newassigned

comment:4 Changed 10 years ago by BruceDechant

Milestone: 2.1
Resolution: fixed
Status: assignedclosed
Version: 2.0.0
Note: See TracTickets for help on using tickets.