Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,253 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
wed plugin String2 crash problem! #350181
12/14/10 12:21
12/14/10 12:21
Joined: Oct 2006
Posts: 23
Turkey
_cash_ Offline OP
Newbie
_cash_  Offline OP
Newbie

Joined: Oct 2006
Posts: 23
Turkey
sory im new in here

i write wed plugin.
//////////////////
void komut_isle(int id,OBJECTINFO *oi)
{
//material ayarlama, şimdilik sadece bu var
if (komutlar[id].komut_id==1)
{
CObjEditInterface *oei=gp_WedInterface->object_GetEditInterface();

oei->obje_SelectObjID(oi->Id,true);
MODELINFO mi;
oei->obje_GetInfo (&mi);
strncpy(mi.String1,komutlar[id].komut_data,30);
strcpy(mi.String2,"ddd"); //this line crash
}
}
////////////////////////
i can change String1 but cant change String2
why?

please help.

(sory for bad english)

Re: wed plugin String2 crash problem! [Re: _cash_] #350248
12/14/10 20:10
12/14/10 20:10
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
What's the reason for the crash?
Is String2 Correctly filled before? (debug with an entity, which has a filled string2)
Is it a null pointer?

Please give more information about the error-message.

Re: wed plugin String2 crash problem! [Re: TechMuc] #350252
12/14/10 20:38
12/14/10 20:38
Joined: Oct 2006
Posts: 23
Turkey
_cash_ Offline OP
Newbie
_cash_  Offline OP
Newbie

Joined: Oct 2006
Posts: 23
Turkey
---------------------------
WED
---------------------------
Crash in 'C:\Program Files (x86)\GStudio7\wed_plugins\si_AyarYukleyici.dll'
---------------------------
OK
---------------------------

this is err message.



i think String2 pointer has no memory area.
but if i alloc memory for String2,
in this case code runs but notting changed
its mean String2 not change.


////////////////
void komut_isle(int id,OBJECTINFO *oi)
{
//material ayarlama, şimdilik sadece bu var
if (komutlar[id].komut_id==1)
{
CObjEditInterface *oei=gp_WedInterface->object_GetEditInterface();

MODELINFO mi;
oei->obje_GetInfo (&mi);
strncpy(mi.String1,komutlar[id].komut_data,30);
mi.String2= new char[31]; //alloc memory for String2
strcpy(mi.String2,"ddd"); //this time not crash in this line but String2 not set
}
}
///////////////

thankyou for your time.

Re: wed plugin String2 crash problem! [Re: _cash_] #350258
12/14/10 21:02
12/14/10 21:02
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline
User
Stromausfall  Offline
User

Joined: Dec 2002
Posts: 616
Austria
hmm did you try to allocate the memory for String2 like this :

mi.String2 = malloc(sizeof(char) * 31);

and not

mi.String2= new char[31];

? maybe the program internally tries to change the string2 and thus tries to deallocate the string2, but not using delete, but free !

edit: i just saw that you already have no crash, so this post won't be useful smirk

Last edited by Stromausfall; 12/14/10 21:07.

get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: wed plugin String2 crash problem! [Re: Stromausfall] #350263
12/14/10 21:32
12/14/10 21:32
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
what happens if the entity already have set up a string2 in wed?

Re: wed plugin String2 crash problem! [Re: TechMuc] #350307
12/15/10 11:05
12/15/10 11:05
Joined: Oct 2006
Posts: 23
Turkey
_cash_ Offline OP
Newbie
_cash_  Offline OP
Newbie

Joined: Oct 2006
Posts: 23
Turkey
TechMuc, i respect you.

i check my test scene and i see that, all entitty's String1 have a value,
but String2s not.

if i manualy set all entitys String2,
plugin correctly run.

thank you for suggestion.

but its not solve for me.
my code must run all case,
if String2 is not set, plugin must set a value.

i think problem is allocation.

how i alloc memory to StringX and wed accept that.
because wed not accept that: (mi.String2= new char[31]wink

thank you for your interest.

Re: wed plugin String2 crash problem! [Re: _cash_] #350310
12/15/10 11:42
12/15/10 11:42
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
you have already been given suggestions:

mi.String2 = malloc(sizeof(char) * 31);


3333333333
Re: wed plugin String2 crash problem! [Re: Quad] #350315
12/15/10 12:08
12/15/10 12:08
Joined: Oct 2006
Posts: 23
Turkey
_cash_ Offline OP
Newbie
_cash_  Offline OP
Newbie

Joined: Oct 2006
Posts: 23
Turkey
Quadraxas read Stromausfalls post carefully

Re: wed plugin String2 crash problem! [Re: _cash_] #350318
12/15/10 12:25
12/15/10 12:25
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
oh right no crash...

i had several plugins, never actually worked with string2, but if you can send me a stripped down version of your project i could make expirements.

Last edited by Quadraxas; 12/15/10 12:27.

3333333333
Re: wed plugin String2 crash problem! [Re: Quad] #350319
12/15/10 12:53
12/15/10 12:53
Joined: Oct 2006
Posts: 23
Turkey
_cash_ Offline OP
Newbie
_cash_  Offline OP
Newbie

Joined: Oct 2006
Posts: 23
Turkey
i cant send project to you sory.

problem is not only string2
if string1 is empty in this case this line crash
strncpy(mi.String1,komutlar[id].komut_data,30);

its mean i think string1 or string2 not important
if editbox is empty you cant transfer data to string area.

Page 1 of 2 1 2

Moderated by  TWO 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1