Commit Graph

17887 Commits

Author SHA1 Message Date
Darragh Coy 8ca3cf8a93 Update the test for dangling node pointers in the events system.
Should be run when the debug event listener verification for nodes is switched on.
2014-03-27 16:38:06 -07:00
Darragh Coy ba450f786c Fix the new test added to the event dispatcher tests 2014-03-27 16:16:27 -07:00
Darragh Coy 2b7116060d Add a test for events being sent to destroyed nodes. 2014-03-27 16:00:21 -07:00
Darragh Coy 83495e6e9b Macro wrap some of the other debug checks related to event listeners. 2014-03-27 15:39:52 -07:00
Darragh Coy c6cd927ea5 When an event listener is removed from the scene and has a node associated with it, NULL out the node pointer so as not to leave any dangling pointers. 2014-03-27 15:37:16 -07:00
Darragh Coy a778d07ecc Undo most of the rest of the event dispatcher related changes in this fix. Will update with a much more elegant solution that does not disturb the existing code so much and which ensures no dangling pointers. 2014-03-27 15:22:11 -07:00
Darragh Coy 824efceb3f Revert "Review feedback: fix memory leak discovered."
This reverts commit 07646f1c82.
2014-03-27 15:14:37 -07:00
Darragh Coy 8ee90389b4 Review feedback: Wrap the debug verification in additional macros which are disabled by default.
Require the user to enable 'CC_NODE_DEBUG_VERIFY_EVENT_LISTENERS' in ccConfig.h in order to enable the debug checks in debug builds.
2014-03-27 12:29:28 -07:00
Darragh Coy 6e19da12c3 Review feedback: Remove unnecessary check of EventListener::getSceneGraphPriority() for fixed event listeners.
Fixed priority event listeners never have an associated node.
2014-03-27 11:59:07 -07:00
Darragh Coy 07646f1c82 Review feedback: fix memory leak discovered.
Always safe release the listener we retain - shift where release happens to the end of the block. Reproduced the leak using the Xcode Leaks instrument in the RemoveListenerAfterAddingTest and verified fixed after apply this change.
2014-03-27 11:28:27 -07:00
Darragh Coy 0ee1095e37 Fix crashes in event dispatch other related safety checks/fixes
1: Add a fix to prevent events from being sent to scene nodes which are destroyed. Previously when a node was being destroyed it would try to unregister any event listeners it would have. This process would fail however in the case where event dispatching was already underway because we can't modify the listeners list while we are iterating through it. This is a pretty common occurrence since we often tear down & switch scenes in response to button clicks etc. Fix the problem by nulling out the slot for the listener we are removing in this case, so that it's node no longer receives any events after it is destroyed. The event dispatching code will cleanup this unused/nulled slot once the event processing loop has terminated.

2: When removing an event listener in cocos2d::EventDispatcher, ensure immediately it gets removed from the node priority map and dirty nodes set in order to ensure we don't inadvertently access any dangling pointers to nodes.

3: Add debug checks to ensure nodes have no associated event listeners after they are destroyed. This check will catch the problem fixed by (1) if it is still present.

4: Add some extra debug sanity checks in the event dispatcher to ensure nodes are not added to the lists twice and that they are being properly removed from the lists under certain conditions.

5: In cocos2d::Node's destructor NULL out members after releasing them in case they somehow happen to be accessed during the destructor. Move the release of the event dispatcher to the very end, since we need to check against it in debug.
2014-03-26 13:12:44 -07:00
James Chen 5ba2cbb5a0 Update AUTHORS [ci skip] 2014-03-26 20:15:13 +08:00
James Chen 2c616fc9da Merge pull request #6005 from flashjay/develop
remove deprecated code in lua tests & template
2014-03-26 20:12:10 +08:00
James Chen 57b298a57a Merge pull request #6006 from CocosRobot/update_lua_bindings_1395835692
[AUTO]: updating luabinding automatically
2014-03-26 20:10:43 +08:00
CocosRobot 8efb9ad4e0 [AUTO]: updating luabinding automatically 2014-03-26 12:09:41 +00:00
James Chen 049e758cbf Merge pull request #6004 from dumganhar/develop
Fixed  <alloca.h> wasn't exist on Windows
2014-03-26 20:04:19 +08:00
James Chen 8ca714fa67 Windows will not include <alloca.h>. 2014-03-26 19:43:34 +08:00
faryang-rmbp 491dc202df remove deprecated code in lua tests & template 2014-03-26 19:42:07 +08:00
James Chen d9b4b70ed7 Removed unused include file. 2014-03-26 19:28:10 +08:00
James Chen 1dbfc9e10a Merge pull request #5988 from andyque/fix_silder_hittest
closed 4560,  fixed slider hitTest position
2014-03-26 19:27:41 +08:00
James Chen 4c848861aa Merge pull request #6001 from CocosRobot/update_cocosfiles_1395830476
[AUTO][ci skip]: updating cocos2dx_files.json
2014-03-26 19:15:06 +08:00
James Chen 2a5c2b0e7e Merge pull request #6002 from CocosRobot/update_lua_bindings_1395830496
[AUTO]: updating luabinding automatically
2014-03-26 19:14:42 +08:00
CocosRobot ebc09373e3 [AUTO]: updating luabinding automatically 2014-03-26 10:42:58 +00:00
CocosRobot 41110ec49a [AUTO][ci skip]: updating cocos2dx_files.json 2014-03-26 10:41:17 +00:00
James Chen 8d035f4333 Update CHANGELOG [ci skip] 2014-03-26 18:31:53 +08:00
James Chen cdd7356512 Merge pull request #5969 from nutty898/develop_nutty_modifylayout_add_Boxes
closed #4534: Adding HBox, VBox layouts, refactoring 'doLayout' function.
2014-03-26 18:30:17 +08:00
James Chen 789044f51d Merge pull request #6000 from CocosRobot/update_lua_bindings_1395829485
[AUTO]: updating luabinding automatically
2014-03-26 18:27:32 +08:00
CocosRobot 6e86e65038 [AUTO]: updating luabinding automatically 2014-03-26 10:25:55 +00:00
James Chen 849d7b9109 Merge pull request #5996 from chengstory/AddNewCreateNodeWay
Adding support of using CCComRender as parent for attached component
2014-03-26 18:20:34 +08:00
CaiWenzhi a05969c395 Move layout "exe" to cpp 2014-03-26 17:58:53 +08:00
zhangcheng f564c4e34a 1. Spirte -> Sprite.
2. _EMPTYNODE -> EMPTY_NODE.
2014-03-26 17:55:35 +08:00
zhangcheng c1ff610277 use capital letters for enum. 2014-03-26 17:21:09 +08:00
zhangcheng 1e6b9f7d9f remove isRenderer. 2014-03-26 17:02:37 +08:00
zhangcheng 58a61d94fb add use CCComRender as parent for attaching component 2014-03-26 16:39:32 +08:00
James Chen faa815eee2 Update CHANGELOG [ci skip] 2014-03-26 16:36:04 +08:00
James Chen 22fdbbb198 Merge pull request #5980 from Dhilan007/develop_label2
Refactor implementation of label's shadow and fixed stroke was not 'outside stroke' for Label generated by 'Font name'
2014-03-26 16:32:04 +08:00
James Chen b0e315637a Merge pull request #5992 from andyque/fix_typo
issue #4401, fix a typo
2014-03-26 16:04:00 +08:00
andyque 876f643bc4 issue #4401, fix a typo 2014-03-26 16:00:55 +08:00
James Chen 8e8de82feb Merge pull request #5991 from dumganhar/develop
Mac build fix after merging https://github.com/cocos2d/cocos2d-x/pull/5989
2014-03-26 15:46:15 +08:00
James Chen 1003847cd1 Mac build fix after merging https://github.com/cocos2d/cocos2d-x/pull/5989 2014-03-26 15:44:38 +08:00
James Chen 21ba509a35 Merge pull request #5989 from dumganhar/iss4559-ios-64bit
closed #4559: Wrong behavior of multi-touch on iphone5s/ipadAir (arm64 arch)
2014-03-26 15:27:57 +08:00
James Chen c1faad7e2c Warning fixes in SocketIOTest.cpp/ FileUtilsTest.cpp. 2014-03-26 15:04:45 +08:00
James Chen 691442d80d closed #4559: Wrong behavior of multi-touch on iphone5s/ipadAir (arm64 arch) 2014-03-26 15:04:11 +08:00
minggo 5e2ffc45ec Merge pull request #5985 from andyque/remove_pragma_mark
issue #4401, remove unused pargma mark macro
2014-03-26 14:58:37 +08:00
andyque 57d8f155df issue #4401. resolve conflicts 2014-03-26 14:54:50 +08:00
James Chen 9d4f7467c0 Merge pull request #5984 from CocosRobot/update_lua_bindings_1395813723
[AUTO]: updating luabinding automatically
2014-03-26 14:46:47 +08:00
James Chen 3e175b7ab3 Merge pull request #5987 from lmskater/fix-git-fetch-fail
[Jenkins] Make build as failed when git fetch is failed
2014-03-26 14:44:18 +08:00
andyque 6449ced0ab closed #4560, fixed UISlider hitTest Point 2014-03-26 14:41:53 +08:00
lm 640a82c2ab [Jenkins] Make build as failed when git fetch is failed 2014-03-26 14:29:53 +08:00
Dhilan007 fa91bf1167 remove unused code and fixed warning. 2014-03-26 14:11:40 +08:00