Stop button is not working.why?

dialog.cpp
Qt Code:
  1. #include "dialog.h"
  2. #include "ui_dialog.h"
  3.  
  4.  
  5. Dialog::Dialog(QWidget *parent) :
  6. QDialog(parent),
  7. ui(new Ui::Dialog)
  8. {
  9. ui->setupUi(this);
  10. mThread = new MyThread(this);
  11. connect(mThread,SIGNAL(NumberChanged(int)),this, SLOT(onNumberChanged (int)) );
  12. }
  13.  
  14. Dialog::~Dialog()
  15. {
  16. delete ui;
  17. }
  18.  
  19. void Dialog::onNumberChanged(int Number)
  20. {
  21. ui->label->setText(QString::number (Number));
  22. }
  23.  
  24. void Dialog::on_pushButton_clicked()
  25. {
  26. //start
  27. mThread->start ();
  28. }
  29.  
  30. void Dialog::on_pushButton_2_clicked() //This part
  31. {
  32. //stop
  33. mThread->Stop = true;
  34. }
To copy to clipboard, switch view to plain text mode 

myThread.cpp
Qt Code:
  1. #include "mythread.h"
  2. #include<QtCore>
  3.  
  4. MyThread::MyThread(QObject *parent) :
  5. QThread(parent)
  6. {
  7.  
  8. }
  9.  
  10. void MyThread::run()
  11. {
  12. for(int i = 0; i < 10000; i++)
  13. {
  14. QMutex mutex;
  15. mutex.lock();
  16. if(this->Stop) //break;
  17. mutex.unlock();
  18.  
  19. emit NumberChanged (i);
  20.  
  21. this->msleep (100);
  22. }
  23.  
  24. }
To copy to clipboard, switch view to plain text mode 

dialog.h
Qt Code:
  1. #ifndef DIALOG_H
  2. #define DIALOG_H
  3.  
  4. #include"mythread.h"
  5. #include <QDialog>
  6.  
  7. namespace Ui {
  8. class Dialog;
  9. }
  10.  
  11. class Dialog : public QDialog
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. explicit Dialog(QWidget *parent = nullptr);
  17. ~Dialog();
  18. MyThread * mThread;
  19. private:
  20. Ui::Dialog *ui;
  21.  
  22. public slots:
  23. void onNumberChanged(int);
  24. private slots:
  25. void on_pushButton_clicked();
  26. void on_pushButton_2_clicked();
  27.  
  28. };
  29.  
  30. #endif // DIALOG_H
To copy to clipboard, switch view to plain text mode