Results 1 to 7 of 7

Thread: QFile, QIODevice bug during appending text?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: QFile, QIODevice bug during appending text?

    "No. The one and only thing I use one QThread is..."
    euhm, that should be a 'yes (but it's disabled at the moment)'

    Just because you do things with signal/slot doesn't mean that you are protected against threading issues when writing to text file.

    From the symptoms, it feels like there must be multiple things opening the file. You also say 'sometimes whole line missing...' which implies you can't consistently repeat the issue. This also hints at multi threaded cause.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  2. #2
    Join Date
    Jun 2010
    Posts
    31
    Qt products
    Qt4
    Platforms
    Windows
    Thanked 1 Time in 1 Post

    Default Re: QFile, QIODevice bug during appending text?

    Quote Originally Posted by amleto View Post
    "No. The one and only thing I use one QThread is..."
    euhm, that should be a 'yes (but it's disabled at the moment)'

    Just because you do things with signal/slot doesn't mean that you are protected against threading issues when writing to text file.

    From the symptoms, it feels like there must be multiple things opening the file. You also say 'sometimes whole line missing...' which implies you can't consistently repeat the issue. This also hints at multi threaded cause.
    Yes, that's the same I think. But I'm very careful with using thread and I use only if I have no chance to avoid it.

    It seems I have fixed it! Using the member "QFile m_file" causes issues. But when I use only inside the write() method a locally generated QFile instance (on stack!) then it works! But I will test it more exactly.

Similar Threads

  1. Replies: 4
    Last Post: 17th May 2009, 18:21
  2. Appending text to a file
    By janus in forum General Programming
    Replies: 8
    Last Post: 25th March 2009, 11:23
  3. Cannot append to QFile using QIODevice::Append
    By philwinder in forum Qt Programming
    Replies: 4
    Last Post: 17th November 2008, 09:09
  4. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58
  5. Replies: 2
    Last Post: 17th November 2006, 11:25

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
  •  
Qt is a trademark of The Qt Company.