I think i have fixed the issue in https://github.com/cocos2d/cocos2d-x/pull/2954.
Could you also apply it to your codes? I means that please refer to my changes.
Please give me your feedback. Thanks.
I think i have fixed the issue in https://github.com/cocos2d/cocos2d-x/pull/2954.
Could you also apply it to your codes? I means that please refer to my changes.
Please give me your feedback. Thanks.
James Chen wrote:
I think i have fixed the issue in https://github.com/cocos2d/cocos2d-x/pull/2954.
>
Could you also apply it to your codes? I means that please refer to my changes.
Please give me your feedback. Thanks.
The changes to CCNode.cpp definitely break reference counting for us. If I don’t include those changes, then everything is still fine. Was that a change needed due to something else in the develop branch?
Joel Poloney wrote:
James Chen wrote:
> I think i have fixed the issue in https://github.com/cocos2d/cocos2d-x/pull/2954.
>
> Could you also apply it to your codes? I means that please refer to my changes.
> Please give me your feedback. Thanks.
>
The changes to CCNode.cpp definitely break reference counting for us. If I don’t include those changes, then everything is still fine. Was that a change needed due to something else in the develop branch?
why? why my changes break reference counting?
This changes fixed the issue @Mutoo Lau replied!
Could you give me a hint?
James Chen wrote:
why? why my changes break reference counting?
This changes fixed the issue @Mutoo Lau replied!
Could you give me a hint?
I’m hitting the assert in CCObject::release()
void CCObject::release(void)
{
CCAssert(m_uReference > 0, "reference count should greater than 0");
--m_uReference;
if (m_uReference == 0)
{
delete this;
}
}
This happens almost immediately on load.
Could you provide the crash stack? Which platform? More informations please!
I tested it with TestJavascript/extensiontest/TableViewTest,it worked fine!
Happening on both iOS and Android platforms. For some reason, XCode isn’t letting me copy the stack trace. I took a screenshot of it and attached it to this thread.
I was able to get a strack trace from Android. Here it is:
06-20 13:43:32.503: I/DEBUG(9535): #00 pc 00015a2e /system/lib/libc.so (dlfree)
06-20 13:43:32.503: I/DEBUG(9535): #01 pc 00016118 /system/lib/libc.so (free)
06-20 13:43:32.503: I/DEBUG(9535): #02 pc 0000ff14 /system/lib/egl/libGLESv2_mali.so (_gles_buffer_object_deref)
06-20 13:43:32.503: I/DEBUG(9535): #03 pc 0000ffb4 /system/lib/egl/libGLESv2_mali.so (_gles_delete_buffers)
06-20 13:43:32.508: I/DEBUG(9535): #04 pc 0000bf60 /system/lib/egl/libGLESv2_mali.so (glDeleteBuffers)
06-20 13:43:32.508: I/DEBUG(9535): #05 pc 00694f3a /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d14CCTextureAtlasD2Ev)
06-20 13:43:32.508: I/DEBUG(9535): #06 pc 00694f68 /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d14CCTextureAtlasD0Ev)
06-20 13:43:32.508: I/DEBUG(9535): #07 pc 00661c6e /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d8CCObject7releaseEv)
06-20 13:43:32.508: I/DEBUG(9535): #08 pc 0065cd06 /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d11CCAtlasNodeD2Ev)
06-20 13:43:32.508: I/DEBUG(9535): #09 pc 0066bce2 /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d12CCLabelAtlasD2Ev)
06-20 13:43:32.508: I/DEBUG(9535): #10 pc 0066bcf4 /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d12CCLabelAtlasD0Ev)
06-20 13:43:32.508: I/DEBUG(9535): #11 pc 00661c6e /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d8CCObject7releaseEv)
06-20 13:43:32.513: I/DEBUG(9535): #12 pc 00664408 /data/data/com.redhotlabs.bingo/lib/libcocos_app.so (_ZN7cocos2d10CCDirector16createStatsLabelEv)
I crash too, my js code like this:
var editBox=cc.EditBox.create(cc.size(418,36),cc.Scale9Sprite.create(img_common_editbg));
editBox.setAnchorPoint(cc.p(0,1));
editBox.setPosition(cc.p(33,screenHeight-260));
editBox.setDelegate(this);
and the xcode error like:
Cocos2d: textFieldShouldEndEditing…
Cocos2d: offestY = 0.000000
Cocos2d: offestY = 0.000000
Assertion failure: JSVAL_IS_OBJECT_OR_NULL_IMPL(JSVAL_TO_IMPL(v)), at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/scripting/javascript/spidermonkey-ios/include/js/Value.h:1754
The crash stack is follow:
#0 0x00233868 in JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout) [inlined] at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/scripting/javascript/spidermonkey-ios/include/js/Value.h:468
#1 0x00233859 in JSVAL_TO_OBJECT(JS::Value) [inlined] at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/scripting/javascript/spidermonkey-ios/include/js/Value.h:1754
#2 0x002337f5 in JSB_TableViewDataSource::tableCellAtIndex(cocos2d::extension::CCTableView*, unsigned int) at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/scripting/javascript/bindings/jsb_cocos2dx_extension_manual.cpp:274
#3 0x00233a12 in ZThn20_N23JSB_TableViewDataSource16tableCellAtIndexEPN7cocos2d9extension11CCTableViewEj at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/scripting/javascript/bindings/jsb_cocos2dx_extension_manual.cpp:236
#4 0x000aac61 in cocos2d::extension::CCTableView::updateCellAtIndex at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/extensions/GUI/CCScrollView/CCTableView.cpp:164
#5 0x000ab5ab in cocos2d::extension::CCTableView::scrollViewDidScroll at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/extensions/GUI/CCScrollView/CCTableView.cpp:559
#6 0x000ab5f6 inZThn384_N7cocos2d9extension11CCTableView19scrollViewDidScrollEPNS0_12CCScrollViewE at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/extensions/GUI/CCScrollView/CCTableView.cpp:561
#7 0x000a81a0 in cocos2d::extension::CCScrollView::setContentOffset(cocos2d::CCPoint, bool) at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/extensions/GUI/CCScrollView/CCScrollView.cpp:212
#8 0x000aa747 in cocos2d::extension::CCTableView::_updateContentSize() at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/extensions/GUI/CCScrollView/CCTableView.cpp:299
#9 0x000aab26 in cocos2d::extension::CCTableView::reloadData() at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/extensions/GUI/CCScrollView/CCTableView.cpp:128
#10 0x0022aa07 in js_cocos2dx_extension_CCTableView_reloadData(JSContext**, unsigned int, JS::Value**) at /Applications/XAMPP/xamppfiles/htdocs/client/native/cocos2d-x-2.1.4/projects/WuXia/proj.ios/…/…/…/scripting/javascript/bindings/generated/jsb_cocos2dx_extension_auto.cpp:6144
#11 0x0035ee3f in js::InvokeKernel(JSContext*, JS::CallArgs, js::MaybeConstruct) ()
#12 0x00358c64 in js::Interpret(JSContext**, js::StackFrame**, js::InterpMode) ()
#13 0x0034fbfd in js::RunScript(JSContext**, js::StackFrame**) ()
#14 0x0035eb99 in js::InvokeKernel(JSContext*, JS::CallArgs, js::MaybeConstruct) ()
#15 0x0035f563 in js::Invoke(JSContext**, JS::Value const&, JS::Value const&, unsigned int, JS::Value**, JS::Value*) ()
#16 0x002982ec in JS_CallFunctionValue(JSContext**, JSObject**, JS::Value, unsigned int, JS::Value**, JS::Value**) ()
James Chen wrote:
Could you provide the crash stack? Which platform? More informations please!
I tested it with TestJavascript/extensiontest/TableViewTest,it worked fine!
Select the stack trace lines and pressed the key of ‘command + c’ to copy, you can try it.
Joel Poloney wrote:
Happening on both iOS and Android platforms. For some reason, XCode isn’t letting me copy the stack trace. I took a screenshot of it and attached it to this thread.
>
I was able to get a strack trace from Android. Here it is:
>
[…]
Did you guys try it by pull the latest codes on github ? If so, there is an issue of Multiply Inheritance.
Develop branch is now for cocos2d-x 3.0 now. It’s not stable.
What I mean is to make similar changes to the release version 2.1.4.
Yes, I use v2.1.4 and merge the modify code from:
https://github.com/cocos2d/cocos2d-x/pull/2954.
James Chen wrote:
Did you guys try it by pull the latest codes on github ? If so, there is an issue of Multiply Inheritance.
Develop branch is now for cocos2d-x 3.0 now. It’s not stable.
What I mean is to make similar changes to the release version 2.1.4.
I checked again by the latest codes on github, develop branch. It worked fine. No these errors.
Could you upload the files that changes for this issue? CCNode.cpp and jsb_cocos2dx_extension_manual.cpp ??
I’ll be glad to help you guys find out the problem.
My code is upload to here:
Thanks for you!
James Chen wrote:
I checked again by the latest codes on github, develop branch. It worked fine. No these errors.
Could you upload the files that changes for this issue? CCNode.cpp and jsb_cocos2dx_extension_manual.cpp ??
I’ll be glad to help you guys find out the problem.
In your codes:
void CCNode::setUserObject(CCObject *pUserObject)
{
CC_SAFE_RELEASE(m_pUserObject);
CC_SAFE_RETAIN(pUserObject);
m_pUserObject = pUserObject;
}
should be
void CCNode::setUserObject(CCObject *pUserObject)
{
CC_SAFE_RETAIN(pUserObject);
CC_SAFE_RELEASE(m_pUserObject);
m_pUserObject = pUserObject;
}
Since pUserObject and m_pUserObject may be the same instance. T_T![](.
Did you look at my changes seriously? https://github.com/cocos2d/cocos2d-x/pull/2954/files#L0R509
)aaa.png!
Justin Zhang wrote:
My code is upload to here:
https://github.com/zj831007/jsbtest/blob/master/jsbtest/CCNode.cpp
https://github.com/zj831007/jsbtest/blob/master/jsbtest/jsb_cocos2dx_extension_manual.cpp
>
Thanks for you!
>
James Chen wrote:
> I checked again by the latest codes on github, develop branch. It worked fine. No these errors.
> Could you upload the files that changes for this issue? CCNode.cpp and jsb_cocos2dx_extension_manual.cpp ??
> I’ll be glad to help you guys find out the problem.
Sorry for my mistake, I modified these codes by you advice again, it same works fine now, .
Thanks for your great support!
James Chen wrote:
In your codes:
[…]
>
should be
>
[…]
>
Since pUserObject and m_pUserObject may be the same instance. T_T![](.
Did you look at my changes seriously? https://github.com/cocos2d/cocos2d-x/pull/2954/files#L0R509)aaa.png!
>
Justin Zhang wrote:
> My code is upload to here:
> https://github.com/zj831007/jsbtest/blob/master/jsbtest/CCNode.cpp
> https://github.com/zj831007/jsbtest/blob/master/jsbtest/jsb_cocos2dx_extension_manual.cpp
>
> Thanks for you!
>
> James Chen wrote:
> > I checked again by the latest codes on github, develop branch. It worked fine. No these errors.
> > Could you upload the files that changes for this issue? CCNode.cpp and jsb_cocos2dx_extension_manual.cpp ??
> > I’ll be glad to help you guys find out the problem.