Results 1 to 5 of 5

Thread: Memory leak? sysfer.dll access violation exception

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2016
    Posts
    16
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Memory leak? sysfer.dll access violation exception

    Hello,

    i have written a qml-map widget which gets displayed, but there seems to be an "undefined" object or something like that. I get an access violation exception from sysfer.dll.

    I currently don't know where this comes from. Any help would be appreciated!

    main.cpp
    Qt Code:
    1. #include <QtWidgets/QApplication>
    2. #include <MainWindow.h>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. // load resources from binary
    8. // infos: http://doc.qt.io/qt-5/resources.html
    9. Q_INIT_RESOURCE(qmlsources);
    10.  
    11. MainWindow mw;
    12. mw.show();
    13.  
    14. return a.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    MainWindow.h:
    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QtWidgets/QWidget>
    5. #include <QtWidgets/QMainWindow>
    6. #include <QtWidgets/QPushButton>
    7. #include <QtWidgets/QMenu>
    8. #include <QtWidgets/QMenuBar>
    9. #include <QtWidgets/QLabel>
    10.  
    11. class MainWindow : public QMainWindow
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. MainWindow();
    17. ~MainWindow();
    18.  
    19. protected:
    20. void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
    21.  
    22. private slots:
    23. void quit();
    24.  
    25. private:
    26. QPushButton *_quit;
    27. QMenu *_fileMenu;
    28.  
    29. QLabel *_infoLabel;
    30. QAction *_quitAct;
    31.  
    32. void createMenus();
    33. void createActions();
    34.  
    35.  
    36. };
    37.  
    38. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    MainWindow.cpp:
    Qt Code:
    1. #include <QDir>
    2.  
    3. #include <QtWidgets/QWidget>
    4. #include <QtWidgets/QPushButton>
    5. #include <QtWidgets/QMenu>
    6. #include <QtWidgets/QMenuBar>
    7. #include <QtWidgets/QLabel>
    8. #include <QtWidgets/QBoxLayout>
    9. #include <QtGui/QContextMenuEvent>
    10.  
    11. #include <QQmlEngine>
    12. #include <QQmlComponent>
    13. #include <QQuickView>
    14. #include <QQuickWidget>
    15. #include "MainWindow.h"
    16.  
    17. MainWindow::MainWindow() : QMainWindow ()
    18. {
    19. // embed resources into binary
    20. // infos: http://doc.qt.io/qt-5/resources.html
    21. Q_INIT_RESOURCE(qmlsources);
    22.  
    23. this->resize(1024, 768);
    24.  
    25. createActions();
    26. createMenus();
    27.  
    28. //WORKS!!!
    29. QQmlEngine *engine = new QQmlEngine(this);
    30. QQuickWidget *view = new QQuickWidget(engine, this);
    31. view->setSource(QUrl("qrc:/map.qml"));
    32.  
    33. this->setCentralWidget(view);
    34. view->setResizeMode(QQuickWidget::SizeRootObjectToView);
    35. }
    36.  
    37. MainWindow::~MainWindow()
    38. {
    39.  
    40. }
    41.  
    42. void MainWindow::contextMenuEvent(QContextMenuEvent *event)
    43. {
    44. QMenu menu(this);
    45. menu.addAction(_quitAct);
    46. menu.exec(event->globalPos());
    47. }
    48.  
    49. void MainWindow::createMenus()
    50. {
    51. _fileMenu = menuBar()->addMenu(tr("File"));
    52. _fileMenu -> addAction(_quitAct);
    53.  
    54. }
    55.  
    56. void MainWindow::createActions()
    57. {
    58. _quitAct = new QAction(tr("Quit"), this);
    59. connect(_quitAct, &QAction::triggered, this, &MainWindow::quit);
    60.  
    61. }
    62.  
    63. void MainWindow::quit()
    64. {
    65. // _infoLabel->setText(tr("Invoked <b>File|Quit</b>"));
    66. exit(1);
    67. }
    To copy to clipboard, switch view to plain text mode 

    map.qml:
    Qt Code:
    1. import QtQuick 2.3
    2. import QtPositioning 5.6
    3. import QtLocation 5.6
    4.  
    5. Map {
    6. id: map
    7. width: 640
    8. height:480
    9.  
    10. plugin: Plugin {
    11. name: "osm"
    12. }
    13.  
    14. center {
    15. latitude: -27
    16. longitude: 153
    17. }
    18. zoomLevel: 10
    19. gesture.enabled: true
    20.  
    21. Component.onCompleted: {
    22. console.log("Dimensions: ", width, height)
    23. }
    24. }
    To copy to clipboard, switch view to plain text mode 

    Using VisualStudio2015 Ultimate, compiling as debug mode!

    Thanks in advance for any hint or comment!
    Last edited by froeben; 18th February 2016 at 08:14.

Similar Threads

  1. Access violation using QTableWidget
    By mchome in forum Newbie
    Replies: 2
    Last Post: 4th September 2012, 07:39
  2. Replies: 3
    Last Post: 24th April 2012, 00:06
  3. Access violation when closing application
    By doggrant in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2012, 15:07
  4. Access violation -- qobject.cpp
    By willief in forum Newbie
    Replies: 9
    Last Post: 14th February 2011, 22:55
  5. Access Violation with VS2008
    By Takatschio in forum Qt Programming
    Replies: 3
    Last Post: 19th August 2010, 09:16

Tags for this Thread

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.