Note that there are some explanatory texts on larger screens.

plurals
  1. POQT crashes when trying to change a string from a class
    primarykey
    data
    text
    <p>Here are my scripts:</p> <pre><code>void FileOperations::SetInputFile(QString x){ InputFilename=x.toStdString(); } void FileOperations::SetOutputFile(QString x){ OutputFilename=x.toStdString(); } </code></pre> <p>The first one (SetInputFile) crashes when trying to set InputFilename to x. The second one works fine.</p> <p>Here is the class that i am changing those two strings from:</p> <pre><code>class FileOperations { public: void SetInputFile(QString x); void SetOutputFile(QString x); private: string InputFilename; string OutputFilename; }; </code></pre> <p>As you can see, 'InputFilename' and 'OutputFilename' are identical, and their functions are almost identical also. I tried changing the strings to different names, but it still crashes.</p> <p>After it crashes I can press debug, and view the errors in Microsoft Visual Studio 2010, here is the crash info:</p> <blockquote> <p>msvcr100d.dll!operator delete(void * pUserData) Line 52 + 0x3 bytes C++ ShitLEncoder.exe!std::allocator::deallocate(char * _Ptr, unsigned int __formal) Line 182 + 0x9 bytes C++ ShitLEncoder.exe!std::basic_string,std::allocator >::_Tidy(bool _Built, unsigned int _Newsize) Line 1998 C++ ShitLEncoder.exe!std::basic_string,std::allocator >::assign(std::basic_string,std::allocator > &amp;&amp; _Right) Line 722 C++ ShitLEncoder.exe!std::basic_string,std::allocator >::operator=(std::basic_string,std::allocator > &amp;&amp; _Right) Line 710 C++ ShitLEncoder.exe!FileOperations::SetInputFile(QString x) Line 8 + 0x26 bytes C++ ShitLEncoder.exe!MainWindow::on_OpenButton_clicked() Line 20 C++ ShitLEncoder.exe!MainWindow::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 72 + 0x8 bytes C++ ShitLEncoder.exe!MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void * * _a) Line 106 + 0x15 bytes C++ Qt5Cored.dll!615820e0()<br> [Frames below may be incorrect and/or missing, no symbols loaded for Qt5Cored.dll]<br> Qt5Cored.dll!615c613f()<br> Qt5Cored.dll!615c5ac1()<br> Qt5Widgetsd.dll!66a7118b()<br> Qt5Widgetsd.dll!66727087()<br> Qt5Widgetsd.dll!6672703b()<br> Qt5Widgetsd.dll!66728092()<br> Qt5Widgetsd.dll!66629ef5()<br> Qt5Widgetsd.dll!66624c40()<br> Qt5Widgetsd.dll!665e0887()<br> Qt5Widgetsd.dll!66625405()<br> Qt5Widgetsd.dll!6665de30()<br> Qt5Widgetsd.dll!665f15a0()<br> Qt5Widgetsd.dll!665e0253()<br> msvcr100d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1267 + 0xc bytes C++ 0246b188() </p> </blockquote> <p>The first thing it shows in code is:</p> <pre><code>_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead-&gt;nBlockUse)); </code></pre> <p>I am using QT 5 with the QT Creator.</p> <p>[EDIT] Here is the code that the QT mainwindow class uses to call those functions:</p> <pre><code>void MainWindow::on_OpenButton_clicked() { ui-&gt;OpenText-&gt;setText(QFileDialog::getOpenFileName(this, tr("Open File"),"",tr("Any file"))); FileController-&gt;SetInputFile(ui-&gt;OpenText-&gt;text()); } void MainWindow::on_SaveButton_clicked() { ui-&gt;SaveText-&gt;setText(QFileDialog::getSaveFileName(this, tr("Save File"),"",tr("Any file"))); FileController-&gt;SetOutputFile(ui-&gt;SaveText-&gt;text()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload