Results 1 to 3 of 3

Thread: Webview and EXC_BAD_ACCESS

  1. #1

    Default Webview and EXC_BAD_ACCESS

    Hi everyone.

    I did an override of NetworkReply to handle "tweeked" HTTP requests inside a Custom Network Access Manager in a webview. It works great for a web pages that do not have any images or javascript links. But as soon as a secondary image or javascript page is called the app crashes with a Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 error when using webkit.

    The odd thing is the stack shows the error on a line that is not editable from me and appears to happen after the custom NetworkAccessManager returns back to the WebView.

    I have been able to prove that each NetworkAccessManager and each Custom NetworkReply is using a different memory address, so I am not sure where error is coming from.

    Has anyone seen something similar.

    Jon

  2. #2

    Default Re: Webview and EXC_BAD_ACCESS

    Ok, this is weird. I have narrowed the error to a line that it is in the MOC. I still can't figure out where the BAD ACCESS is coming from, but I am perplexed about the function in general.

    This is what it produced. I am confused on what it's purpose is, especially the if _ID<0 then return the _id; else it returns the _id. What is the point of the IF?

    How are these MOCs produced?

    int QCustomNetworkReply::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
    {
    _id = QNetworkReply::qt_metacall(_c, _id, _a);
    if (_id < 0)
    return _id;
    return _id;
    }

    Thanks

    Jon

  3. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Webview and EXC_BAD_ACCESS

    Difficult to tell without looking at the code what's going wrong.
    I guess that because you're accessing a network some async signal is trying to access a part of memory that it shouldn't.

    MOC files are produced by meta-object compiler.

    as to the qt_metacall function, it's how it looks when object has no signals/slots defined, it's just a scaffolding and it's there beacuse Q_OBJECT macro was defined in the header file.
    (ps please use [code] tags)
    Qt Code:
    1. int StatusProcess::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
    2. {
    3. _id = QProgressBar::qt_metacall(_c, _id, _a);
    4. if (_id < 0)
    5. return _id;
    6. return _id;
    7. }
    To copy to clipboard, switch view to plain text mode 
    as soon as you define some signal or slot the function will start to grow and will look something like that:
    Qt Code:
    1. int StatusProcess::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
    2. {
    3. _id = QProgressBar::qt_metacall(_c, _id, _a);
    4. if (_id < 0)
    5. return _id;
    6. if (_c == QMetaObject::InvokeMetaMethod) {
    7. switch (_id) {
    8. case 0: someSignal(); break;
    9. case 1: someSlot(); break;
    10. default: ;
    11. }
    12. _id -= 2;
    13. }
    14. return _id;
    15. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Proxy in Webview?
    By "BumbleBee" in forum Newbie
    Replies: 1
    Last Post: 29th January 2012, 13:54
  2. EXC_BAD_ACCESS error when widget is displayed
    By sparticus_37 in forum Qt Programming
    Replies: 0
    Last Post: 19th August 2010, 06:55
  3. WebView
    By mskzo in forum Qt Programming
    Replies: 7
    Last Post: 5th December 2008, 21:18
  4. Replies: 5
    Last Post: 17th July 2008, 13:12
  5. webView
    By peace_comp in forum Qt Programming
    Replies: 1
    Last Post: 6th July 2008, 17:57

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.