Friday, February 25, 2011

Using an osg::ref_ptr for 'this' in the constructor is a bad idea

Inside a constructor, the reference count of 'this' is still zero. If you use a local osg::ref_ptr to reference 'this', the reference count will increment to one. However, when the constructor ends, the lifetime of the osg::ref_ptr also ends, and the reference count will become zero again, and 'this' will be destroyed.

Monday, February 21, 2011

Starting a QThread

We must create the QApplication (or QCoreApplication) object before we create a QThread.

Thursday, February 17, 2011

[NSArray objectEnumerator]

NSEnumerator * enumerator = [array objectEnumerator];
id arrayItem;

while (arrayItem = [enumerator nextObject]) {
   // Do something about arrayItem
}

Testing

This is the first blog.

Angus Lau