![]() |
【转帖】wo Layers With Same Name In File
two layers with same name in file
two layers with same name in file hi, i noticed a error in dwgdirect library, version 1.10 updated. while opening a dxf file containing two layers, both with the same name, application crashes. acad opens the same file normally keeping only one layer. will you sove this error, or will consider a error in file? regards, regina keller. surely such files are incorrect but dd 1.11 will give warning while opening such files in open mode and report fixed error in recover mode. sergey slezkin still having problems hi sergey, i updated library to 1.11 version and problem still happening. was problem really solved? i'm using c++builder 6. i noticed that geoff briggs is having the same problem in thread "problems with borland builder 6". i'm using the code bellow and program doens't stop in catch and a exception is raised. i'm attaching a file with problem. regards, regina. code: try { // create a database and load the drawing into it. oddbdatabaseptr pdb = svcs.readfile( filename, false, false, oda::ksharedenyno ); if (!pdb.isnull()) { sbuffer.init(); sbuffer << "file version: " << pdb->originalfileversion() << ends; strings->add(buffer); dbdumper dumper; dumper.dump(pdb, &svcs, strings); } } catch (oderror& e) { sbuffer.init(); sbuffer << "dwgdirect error: " << svcs.geterrordescription(e.code()).c_str() << ends; strings->add(buffer); } catch (...) { sbuffer.init(); sbuffer << "unknown error." << ends; strings->add(buffer); } attached files (1.6 kb, 4 views) the problem seems to bc6 specific. while loading dxf file table entries are added using: code: try { add(pentry); } catch (oderror & err) { switch (err.code()) { case eduplicaterecordname: ..... if a duplicate record ocurs in file exception thrown from add() is handled inside dd. probably for some reason it is not handled in bc6. we already saw such strange behavior: exception thrown from conditional expression was not handled and it was ok after we replaced conditional expression with if-else : code: // exception thrown from func1() is not handled try { someptr = (expression) ? func1() : func2(); } catch // works: try { if (condition) { someptr = func1(); } else { someptr = func2(); } } catch sergey slezkin exceptions not handled in bc6 hi sergey, i think the problem is really in bc6. i tried enable the 'stop in c++ exceptions' and app stoped with oderro_duplicaterecordname exception. (menu: tools-> debugger options-> language exceptions) exception is raised, but not catched by try\catch(...). there is another way to handle this exception or any other that can be throwed? i noticed that in the code bellow exceptions also aren't catched. code: void abcd( bool exc ) throw() { if (exc) throw 1234; } main() { try { abcd(true); } catch(...) { // any code, that never is executed } } regards, regina keller hi regina, the changes fixed bug with duplicaterecordname were next: code: // in case of using: // throw oderror_duplicaterecordname(pimpl->m_items[*iter].getval()); // bb6 throws unhandled exception oddbobjectid id = pimpl->m_items[*iter].getval(); throw oderror_duplicaterecordname(id); suggestions why bb6 throws unhandled exception in first case (getval() returns const oddbobjectid&) will be appreciated the fix will be available in 1.11 update (as i know it is planed for next week). as regards your last example, an empty exception specification implies a function throws no exceptions: void f() throw() { // ... function throws no exceptions ... } vc6/7 handle exceptions anyway, but bb6 generates unhandled exception. bb6 will work correctly if you remove throw() exception specification. regards, sergey vishnevetsky |
所有的时间均为北京时间。 现在的时间是 09:10 PM. |