Changeset 138 for trunk/orca
- Timestamp:
- 05/04/06 21:52:56 (3 years ago)
- Location:
- trunk/orca
- Files:
-
- 3 modified
-
ovalue.c (modified) (1 diff)
-
qt/qorca.cpp (modified) (8 diffs)
-
qt/qorca.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/orca/ovalue.c
r137 r138 523 523 void orFreeEnv( OEnv* env ) 524 524 { 525 if( orEnv == env ) 526 orEnv = 0; 527 525 528 orFreeArrayOfArray( &env->blocks ); 526 529 orFreeArrayOfArray( &env->strings ); -
trunk/orca/qt/qorca.cpp
r91 r138 32 32 33 33 34 inline bool qEnvExists() { return qEnv.atom_close > 0; } 35 36 34 37 struct LayoutInfo 35 38 { … … 103 106 104 107 105 int WIDPool::add( QObject* ptr, int type ) 108 /** 109 Returns REC id. 110 */ 111 int WIDPool::add( QObject* ptr, int type, int flags ) 106 112 { 107 113 int index; … … 114 120 115 121 rec.type = type; 122 rec.flags = flags; 116 123 rec.object = ptr; 117 124 … … 123 130 REC rec; 124 131 rec.type = type; 132 rec.flags = flags; 125 133 rec.object = ptr; 126 134 _records.push_back( rec ); … … 132 140 void WIDPool::remove( int id ) 133 141 { 134 REC& rec = _records[ id ]; 135 136 assert( rec.widget ); 137 138 rec.type = _freeIndex; 139 _freeIndex = id; 140 rec.object = 0; 141 142 ++_freeCount; 142 if( qEnvExists() ) 143 { 144 REC& rec = _records[ id ]; 145 146 assert( rec.widget ); 147 148 rec.type = _freeIndex; 149 _freeIndex = id; 150 rec.object = 0; 151 152 ++_freeCount; 153 } 143 154 } 144 155 … … 1310 1321 // orEnv goes away. 1311 1322 1323 qEnv.atom_close = 0; // Using atom_close as qEnvExists indicator. 1324 1312 1325 WIDPool::iterator it; 1313 1326 for( it = qEnv.pool.begin(); it != qEnv.pool.end(); ++it ) 1314 1327 { 1315 if( (*it).widget ) 1316 { 1317 if( (*it).type == WT_Dialog ) 1318 { 1319 delete (*it).widget; 1320 } 1321 else if( (*it).type == WT_Widget ) 1322 { 1323 delete (*it).widget; 1324 } 1325 1326 // Assuming all other widgets are deleted from WT_Dialog & 1327 // WT_Widget. 1328 // Records without DeleteObject flag set are assumed to be child 1329 // widgets of a WT_Dialog or WT_Widget. 1330 1331 WIDPool::REC& rec = *it; 1332 if( rec.object && (rec.flags & WIDPool::DeleteObject) ) 1333 { 1334 delete rec.object; 1328 1335 } 1329 1336 } … … 1383 1390 SWidget::SWidget() 1384 1391 { 1385 _wid = qEnv.pool.add( this, WT_Widget );1392 _wid = qEnv.pool.add( this, WT_Widget, WIDPool::DeleteObject ); 1386 1393 } 1387 1394 … … 1503 1510 1504 1511 1505 #if 0 1506 SDialog::SDialog() { _wid = qEnv.pool.add( this, WT_Dialog ); } 1507 SDialog::~SDialog() { qEnv.pool.remove( _wid ); printf("~SDialog\n"); } 1508 #else 1509 WIDGET_CODE(SDialog,WT_Dialog) 1510 #endif 1512 SDialog::SDialog() 1513 { 1514 _wid = qEnv.pool.add( this, WT_Dialog, WIDPool::DeleteObject ); 1515 } 1516 1517 1518 SDialog::~SDialog() 1519 { 1520 qEnv.pool.remove( _wid ); 1521 //printf("~SDialog\n"); 1522 } 1511 1523 1512 1524 -
trunk/orca/qt/qorca.h
r90 r138 58 58 public: 59 59 60 enum eRecFlags 61 { 62 DeleteObject = 0x0001 63 }; 64 60 65 struct REC 61 66 { 62 int type; 67 short type; 68 short flags; 63 69 union 64 70 { … … 70 76 WIDPool() : _freeCount(0), _freeIndex(-1) {} 71 77 72 int add( QObject*, int type );78 int add( QObject*, int type, int flags = 0 ); 73 79 void remove( int id ); 74 80 REC* record( int id );
