Results 1 to 2 of 2

Thread: Runtime error: Invalid parameter passed to C runtime function.

  1. #1
    Join Date
    Sep 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Runtime error: Invalid parameter passed to C runtime function.

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Runtime error: Invalid parameter passed to C runtime function.

    Quote Originally Posted by Delirium View Post
    I can provide you with the full source code in case you need it to solve my case.
    It would be more useful if you tried reproducing the same behaviour with a minimal compilable example.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Runtime Error
    By sophister in forum Qt Programming
    Replies: 9
    Last Post: 15th June 2009, 07:28
  2. Runtime error
    By nina1983 in forum Qt Programming
    Replies: 2
    Last Post: 11th September 2008, 16:37
  3. QT 4.4 runtime error
    By Ricochet in forum Newbie
    Replies: 1
    Last Post: 5th May 2008, 19:50
  4. runtime error
    By mickey in forum General Programming
    Replies: 10
    Last Post: 12th December 2006, 21:10
  5. runtime error
    By mickey in forum General Programming
    Replies: 1
    Last Post: 11th June 2006, 14:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.