2 registered members (AndrewAMD, Quad),
843
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
No Error just a crash?
#437564
02/19/14 16:43
02/19/14 16:43
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
OP
Expert
|
OP
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
If you assign a skin of a model to the target_map of a panel and then change the level then the engine will just crash instead of giving an error. Put this code into the sample folder and try it:
#include <acknex.h>
#include <default.c>
PANEL* test =
{
bmap = "banana.bmp";
flags=SHOW;
}
void main()
{
level_load("");
ENTITY* testc=ent_create("basket_ball.mdl",nullvector,NULL);
camera.x=-100;
//test.target_map=bmap_for_entity(testc,0);
while(!key_k)wait(1);
wait(-1);
level_load("small.hmp");
}
Comment out that line and you´ll see what i mean. It took me nearly a week to find that nasty bug!
|
|
|
Re: No Error just a crash?
[Re: alibaba]
#437565
02/19/14 17:18
02/19/14 17:18
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
That's not a bug, and that's not something engine is supposed to tell you.
Because entities are destroyed your target_map pointer becomes NULL therefore you get a crash. They could have add check if target_map is NULL but then the people would try and wonder why their panels do not render at all etc..
3333333333
|
|
|
Re: No Error just a crash?
[Re: Superku]
#437573
02/19/14 20:21
02/19/14 20:21
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
OP
Expert
|
OP
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
However, it could be added to the manual as a note/ warning.
This sounds fair enought.
|
|
|
Re: No Error just a crash?
[Re: alibaba]
#437577
02/19/14 21:48
02/19/14 21:48
|
Joined: Feb 2012
Posts: 371
Dico
Senior Member
|
Senior Member
Joined: Feb 2012
Posts: 371
|
The code is work without crash for me , what is problem in it ?
Last edited by Dico; 02/19/14 21:50.
|
|
|
Re: No Error just a crash?
[Re: Superku]
#437579
02/19/14 22:36
02/19/14 22:36
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
The problem is that the engine has to know that the content of the pointer test.target_map is no longer valid to render into and I'm not sure how would one implement an error message for this efficiently. Well, the only option is checking every pointer before using it by iterating over the whole c_list thing. Does not sound reasonable in any way to me. However, it could be added to the manual as a note/ warning. What would such a warning look like? "Beware of vagabonding pointers!"?
Last edited by Uhrwerk; 02/19/14 22:40. Reason: Sorry for the confusion, Superku!
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: No Error just a crash?
[Re: Uhrwerk]
#437580
02/19/14 22:39
02/19/14 22:39
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
I don't get it. How is the engine supposed to detect vagabonding pointers? And what would such a warning look like? "Beware of vagabonding pointers!"? That's exactly what I said/ meant? EDIT: Well, the only option is checking every pointer before using it by iterating over the whole c_list thing. Does not sound reasonable in any way to me. And that's what I was thinking, yes (on deletion of one object).
Last edited by Superku; 02/19/14 22:40.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: No Error just a crash?
[Re: Superku]
#437581
02/19/14 22:49
02/19/14 22:49
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
On deletion is not sufficient. You could store the pointer in any variable and assign it later to the render target / whatever code may use it and crash.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|