User forums > Help

problem with creating new console project

<< < (2/2)

Jenna:
Here is a quick and dirty patch that make wizard work again.
There is surely a better way to do it, but I could not investigate if it's possible to remove a compiled SquirrelFunction from memory.
So this is an easy way and should not be dangerous (as long as no compiler page is called "function_cleared" or whatever string is used as dummy).


--- Code: ---Index: src/plugins/scriptedwizard/wiz.cpp
===================================================================
--- src/plugins/scriptedwizard/wiz.cpp (revision 4750)
+++ src/plugins/scriptedwizard/wiz.cpp (working copy)
@@ -214,7 +214,8 @@
                                                     "function SetupTarget(target,is_debug){return false;};\n"
                                                     "function SetupCustom(){return false;};\n"
                                                     "function CreateFiles(){return _T(\"\");};\n"
-                                                    "function GetFilesDir(){return _T(\"\");};\n"
+                                                    "function GetFilesDir(){return _T(\"\");};\n"
+                                                    "function OnGetNextPage_CompilerPage(){return _T(\"function_cleared\");};\n"
                                                     "function GetGeneratedFile(index){return _T(\"\");};\n");
     Manager::Get()->GetScriptingManager()->LoadBuffer(clearout_wizscripts, _T("ClearWizState"));
 
Index: src/plugins/scriptedwizard/wizpage.cpp
===================================================================
--- src/plugins/scriptedwizard/wizpage.cpp (revision 4750)
+++ src/plugins/scriptedwizard/wizpage.cpp (working copy)
@@ -99,6 +99,8 @@
         if (cb.func.IsNull())
             return wxWizardPageSimple::GetNext();
         wxString next = cb();
+        if (next == _T("function_cleared"))
+            return wxWizardPageSimple::GetNext();
         if (next.IsEmpty())
             return 0;
         return s_PagesByName[next];

--- End code ---

Biplab:
This is a quite serious bug. It not only affects Console wizard; it also affects other wizards (e.g., wxWidgets project wizard) which has one or more pages beyond the Compiler selection page.


--- Quote from: jens on December 25, 2007, 12:47:10 am ---Here is a quick and dirty patch that make wizard work again.
There is surely a better way to do it, but I could not investigate if it's possible to remove a compiled SquirrelFunction from memory.
So this is an easy way and should not be dangerous (as long as no compiler page is called "function_cleared" or whatever string is used as dummy).

--- End quote ---

The quick patch is ok. But it doesn't fix the issue completely. This issue may resurface with other wizards. :)


@Yiannis,

Is it possible to delete the Squirrel compiled function from the memory after it has been executed? I tried to remove it in the following way. But it didn't work. :(

--- Code: ---Index: src/plugins/scriptedwizard/wizpage.cpp
===================================================================
--- src/plugins/scriptedwizard/wizpage.cpp (revision 4750)
+++ src/plugins/scriptedwizard/wizpage.cpp (working copy)
@@ -98,7 +98,8 @@
         SqPlus::SquirrelFunction<wxString&> cb(cbU2C(sig));
         if (cb.func.IsNull())
             return wxWizardPageSimple::GetNext();
-        wxString next = cb();
+        wxString next = cb();
+        cb.reset();
         if (next.IsEmpty())
             return 0;
         return s_PagesByName[next];
--- End code ---

Best regards,

Biplab

Jenna:
Another question I have:
To clear the functions of a formerly run wizardscript, new functions with the same name, but default return-values are compiled.
What happens to the "old" function-pointers and the content of the functions, are they still on the stack (and somewhere in the memory) or are they removed by the SquirrelVM .

If they reside in memory this might be potential dangerous.

Navigation

[0] Message Index

[*] Previous page

Go to full version