From fe1cbe9ca78619b54b08e4ec1155d7e6e4e0640a Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Thu, 3 Oct 2013 23:17:34 +0100 Subject: Add qWarning when trying to read or write a closed device Change-Id: Ifda057d122a30d88749c6401185457f1900a913b Reviewed-by: Oswald Buddenhagen Reviewed-by: Richard J. Moore Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/io/qiodevice.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 8fb80123fa..a81b8580c4 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -99,8 +99,10 @@ void debugBinaryString(const char *data, qint64 maxlen) #define CHECK_WRITABLE(function, returnType) \ do { \ if ((d->openMode & WriteOnly) == 0) { \ - if (d->openMode == NotOpen) \ + if (d->openMode == NotOpen) { \ + qWarning("QIODevice::"#function": device not open"); \ return returnType; \ + } \ qWarning("QIODevice::"#function": ReadOnly device"); \ return returnType; \ } \ @@ -109,8 +111,10 @@ void debugBinaryString(const char *data, qint64 maxlen) #define CHECK_READABLE(function, returnType) \ do { \ if ((d->openMode & ReadOnly) == 0) { \ - if (d->openMode == NotOpen) \ + if (d->openMode == NotOpen) { \ + qWarning("QIODevice::"#function": device not open"); \ return returnType; \ + } \ qWarning("QIODevice::"#function": WriteOnly device"); \ return returnType; \ } \ -- cgit v1.2.3