Problem with deleting QBuffer
-
That's interesting. In my code I tried to replace
newHandler = new FileHandler(file.readAll(), zipFilename);
withnewHandler = new FileHandler(file.readAll());
(without specifying a filename). No crash now. So the issue is not in QBuffer.zipFilename is
QString zipFilename = zip.getCurrentFileName();
. I don't understand what's wrong... -
Please try this:
int main(int argc, char** argv) { QApplication a(argc, argv); FileHandler* csvHandler = nullptr; QVector<QString> files = { "existing_file1.txt", "existing_file2.txt" }; for (const auto& path : files) { QFile f(path); f.open(QIODevice::ReadOnly); auto newHandler = new FileHandler(f.readAll(), path); delete csvHandler; csvHandler = newHandler; } delete csvHandler; return 0; }
In this case the error should appear.
-
No crash here and I also don't see a reason why it should crash.
-
As I said before - please post the stacktrace.
-
This?
-
You are most likely mixing debug and release libs - I would guess you link your debug app against Qt release libs. This is not supported on windows due to different msvc runtimes.
-
@Christian-Ehrlicher said in Problem with deleting QBuffer:
You are most likely mixing debug and release libs - I would guess you link your debug app against Qt release libs. This is not supported on windows due to different msvc runtimes.
Is there a workaround?
I tried this on a release version and it's working well. But what if I want to debug it?
-
@aiphae said in Problem with deleting QBuffer:
Is there a workaround?
I tried this on a release version and it's working well. But what if I want to debug it?
Simple: Link you release build to Qt release libs and your app's debug build to Qt's debug libs.
How did you install Qt?
You should have them. -
@Pl45m4 said in Problem with deleting QBuffer:
Simple: Link you release build to Qt release libs and your app's debug build to Qt's debug libs.
Yes. Apparently I was linking external release libraries instead of debug ones. The issue is solved. Thank you!
-