Hello.

I am writing an editor for lua scripts of a specific game using QScintilla. I have written a stand-alone class (the class name is LuaEditor) for the editor widget. Inside mainwindow.h I have written this function to help me get the instance of the MainWindow so I can change some of its properties through the LuaEditor class:

Cpp Code:
  1. static MainWindow *getInstance()
  2. {
  3. static MainWindow window;
  4. return &window;
  5. }
To copy to clipboard, switch view to plain text mode 

On LuaEditor class there's a function, newFile(), which initializes the editor widget...the code of the newFile() function is this:

Cpp Code:
  1. void LuaEditor::newFile()
  2. {
  3. isUntitled = true;
  4. currentFile = "newScript.lua";
  5. MainWindow::getInstance()->setWindowTitle(tr("QtLuaPad - %1").arg(currentFile));
  6. setText(tr("-- Created using QtLuaPad on %1\n\nfunction onUse(cid, item, frompos, item2, topos)\n\treturn TRUE\nend").arg(QDate::currentDate().toString()));
  7. connect(this, SIGNAL(textChanged()), this, SLOT(setDocumentModified()));
  8. }
To copy to clipboard, switch view to plain text mode 

When I am trying to run the application (release mode), the application crashes and I get the following error:
Invalid parameter passed to C runtime function.
C:\Qt\Projects\QtLuaPad-build-desktop\release\QtLuaPad.exe exited with code 3
and also this error msgbox:
The application has requestes the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
Anybody knows what's going on here? I can provide you with the full source code in case you need it to solve my case. Thanks in advance.

Yours,
Delirium.