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:
static MainWindow *getInstance()
{
static MainWindow window;
return &window;
}
static MainWindow *getInstance()
{
static MainWindow window;
return &window;
}
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:
void LuaEditor::newFile()
{
isUntitled = true;
currentFile = "newScript.lua";
MainWindow::getInstance()->setWindowTitle(tr("QtLuaPad - %1").arg(currentFile));
setText(tr("-- Created using QtLuaPad on %1\n\nfunction onUse(cid, item, frompos, item2, topos)\n\treturn TRUE\nend").arg(QDate::currentDate().toString()));
connect(this, SIGNAL(textChanged()), this, SLOT(setDocumentModified()));
}
void LuaEditor::newFile()
{
isUntitled = true;
currentFile = "newScript.lua";
MainWindow::getInstance()->setWindowTitle(tr("QtLuaPad - %1").arg(currentFile));
setText(tr("-- Created using QtLuaPad on %1\n\nfunction onUse(cid, item, frompos, item2, topos)\n\treturn TRUE\nend").arg(QDate::currentDate().toString()));
connect(this, SIGNAL(textChanged()), this, SLOT(setDocumentModified()));
}
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.
Bookmarks