Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Access violations while trying to destroy() a GuiShowImgCtrl (https://forums.graalonline.com/forums/showthread.php?t=134260085)

Jiroxys7 08-05-2010 07:09 PM

Access violations while trying to destroy() a GuiShowImgCtrl
 
So I'm trying to develop a system that gives you a visual of what buffs you currently have on you. Using a for loop to update itself. I'm still perfecting this, and was trying to see what would happen if I tried destroying the GuiShowImgCtrls each loop before generating new ones. So I added the following line to test destroying the first one on the list:
PHP Code:

Test_ShowImg_1.destroy(); 

Now when I do this, and hit apply, we get a few Access Violations.
the first one states:
Access violation at address 0B043FA2. Read of address FFFFFFFF.

When we close it, we get a new one:
Access violation at address 021F9DD9. Write of address E6BF87E2.

Next one in the order is:
Access violation at address 021F9DD0. Read of address 800B32BD.

Next is:
Access violation at address 021F9DDE. Write of address 00000004.

And finally:
Access violation at address 0B0DBAB8. Write of address 000001FA.

Every following access violation is a repeat of the last one I've listed. Until of course, you remove the line and put it there again.
Just thought I'd share assuming this won't already be fixed/prevented in the next version.



Edit: okay weird thing happened :p

First of all, this worked the first time i tried it without any errors. then when i started getting them, after taking out that line of code and putting it back in a few times, I eventually got another access violation (the last one) and it disconnected me. When I reconnected, there were no access violations, and the number of images representing the buffs on my screen went from 5 to 1. (the first time i tried this, it removed all of the images).

When I removed the line of code again, it went from 1 image to 4. (4 is what its supposed to be displaying)

Putting the line of code in again results in:
Access violation at address 01020318. Write of address 00000000.
Access violation at address 2C302C30. Read of address 2C302C30.
Each following is a repeat of the second.

removing then adding it results in:
Access violation at adress 0A8EFE4B. Write of address 00000054.
Access violation at address 0A8EFE4F. Read of address 50014D06. (repeatedly)

And I'm gonna stop logging these now. They seem like they might be either randomized or part of a giant list :p

Crow 08-05-2010 07:31 PM

There were some issues with destroying GUI controls before creating them I believe. Jerret will probably reply soon and clear things up :p

cbk1994 08-05-2010 07:38 PM

It is fixed in v6. I don't know any way to workaround it as I've never really encountered it.

Jiroxys7 08-05-2010 07:42 PM

Quote:

Originally Posted by Crow (Post 1591606)
There were some issues with destroying GUI controls before creating them I believe. Jerret will probably reply soon and clear things up :p

Weird thing is, suddenly it's inconsistent. It stopped giving me access violation errors a moment ago and the system was working perfectly by destroying the guis before the loop telling it to create them. Then when I decided to run this in a for loop so i could automatically append the GUI names, it stopped working. still no errors though. When i went back to put the destroy(); codes back in, it still didnt work. yet still no errors. So i decided i should try to see if the errors popped up if i put the destroys after the for loop (which is after the guis have been created). and no error messages this time.

though my script now still isnt working. Weird..

Crow 08-05-2010 08:03 PM

Are you checking if the GUI control exists before destroying it?

Jiroxys7 08-05-2010 08:21 PM

Quote:

Originally Posted by Crow (Post 1591614)
Are you checking if the GUI control exists before destroying it?

Yeah I just got it working =P
It didnt work like i thought it would though. Basically every time a gui is created, it adds +1 to a variable. but BEFORE all of that, it used to check if the variable was greater than 1, then delete a gui. like if the variable came back as 5, it would delete the first 5 guis. and then after that for loop, it would set the value to 0 and continue.

weird thing is, it didnt work unless i changed the "> 0" to "== 0". so basically seeing if that variable equals zero. even though it's returning a greater value.

i also ran into a weird problem. sometimes variables dont work if theyre temp.variablename and will only work if theyre this.variablename (yes theyre in the same function. and renaming the name of the variable doesnt change the outcome)

yet in this case, my variable was named this.iconnumbers but it wouldnt work until i changed it to temp.iconnumbers

fowlplay4 08-06-2010 12:04 AM

If you destroy and create a GUI in the same function callstack, exceptions occur not every time but eventually they do.

Work-around:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  if (
isObject("awesomeGUI")) {
    
awesomeGUI.destroy();
  }
  
this.scheduleevent(0.05"CreateGUI"""); // Should be able to use trigger as well, but the difference would be neglible.
}

function 
onCreateGUI() {
  new 
GuiWindowCtrl("awesomeGUI") {
    
10;
    
width height 100;
  }


As for your "this." variable situation, you were probably accessing it at the wrong level of scope.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.value 5;
  new 
GuiButtonCtrl(testButton) {
    
width height 100;
    
= (screenwidth width) / 2;
    
= (screenheight height) / 2;
    
this.other "lol";
    
text "Value: " thiso.value// Would show Value: 5
    
text "Other: " this.other// Would show Other: lol
  
}




All times are GMT +2. The time now is 07:05 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.