[qtoctave] * Thu Oct 6 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.10.1-5 - fix crash when closing a dock t

Kevin Kofler kkofler at fedoraproject.org
Thu Oct 6 22:36:46 UTC 2011


commit 40df652832c14f4edec8f35e0e6ccae87244c8d8
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Fri Oct 7 00:36:36 2011 +0200

    * Thu Oct  6 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.10.1-5
    - fix crash when closing a dock tool within the first 5 seconds (#722986)

 qtoctave-0.10.1-initialposition.patch |   51 +++++++++++++++++++++++++++++++++
 qtoctave.spec                         |   10 ++++++-
 2 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/qtoctave-0.10.1-initialposition.patch b/qtoctave-0.10.1-initialposition.patch
new file mode 100644
index 0000000..7c29d86
--- /dev/null
+++ b/qtoctave-0.10.1-initialposition.patch
@@ -0,0 +1,51 @@
+diff -ur qtoctave-0.10.1/qtoctave/src/main.cpp qtoctave-0.10.1-initialposition/qtoctave/src/main.cpp
+--- qtoctave-0.10.1/qtoctave/src/main.cpp	2011-01-06 22:48:07.000000000 +0100
++++ qtoctave-0.10.1-initialposition/qtoctave/src/main.cpp	2011-10-06 20:17:03.000000000 +0200
+@@ -595,7 +595,7 @@
+ 						initPos.maximized=maximized;
+ 						initPos.minimized=minimized;
+ 						initPos.widget=bw->parentWidget();
+-						if(initPos.widget!=NULL)
++						if(!initPos.widget.isNull())
+ 							initialPositionList.append(initPos);
+ 						//bw->show();
+ 						//bw->move(x,y);
+@@ -694,10 +694,14 @@
+ {
+ 	foreach(InitialPosition i, initialPositionList)
+ 	{
+-		i.widget->move(i.x,i.y);
+-		i.widget->resize(i.width, i.height);
+-		if(i.maximized) i.widget->showMaximized();
+-		if(i.minimized) i.widget->showMinimized();
++		QWidget *widget = i.widget.data();
++		if (widget)
++		{
++			widget->move(i.x,i.y);
++			widget->resize(i.width, i.height);
++			if(i.maximized) widget->showMaximized();
++			if(i.minimized) widget->showMinimized();
++		}
+ 	}
+ }
+ 
+diff -ur qtoctave-0.10.1/qtoctave/src/main.h qtoctave-0.10.1-initialposition/qtoctave/src/main.h
+--- qtoctave-0.10.1/qtoctave/src/main.h	2011-01-06 22:48:08.000000000 +0100
++++ qtoctave-0.10.1-initialposition/qtoctave/src/main.h	2011-10-06 20:12:55.000000000 +0200
+@@ -27,6 +27,7 @@
+ #include <QListWidget>
+ #include <QTimer>
+ #include <QVector>
++#include <QWeakPointer>
+ #include "mainwindow.h"
+ #include "octave_connection.h"
+ #include "terminal.h"
+@@ -41,7 +42,7 @@
+ struct InitialPosition
+ {
+ 	int x, y, width, height;
+-	QWidget *widget;
++	QWeakPointer<QWidget> widget;
+ 	bool maximized, minimized;
+ };
+ 
diff --git a/qtoctave.spec b/qtoctave.spec
index a12931b..e030e9e 100644
--- a/qtoctave.spec
+++ b/qtoctave.spec
@@ -1,6 +1,6 @@
 Name:           qtoctave
 Version:        0.10.1
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Frontend for Octave
 
 Group:          Applications/Engineering
@@ -20,6 +20,11 @@ Requires:       octave >= 3.2.0
 Patch0:         qtoctave-doc-path.patch
 # fix *.m filters in file dialogs (debian#620062, patch by Sébastien Villemot)
 Patch1:         qtoctave-0.10.1-filedialog-filters.patch
+# fix crash when closing a dock tool within the first 5 seconds (#722986)
+# (a NULL pointer dereference caused by a race condition between the user
+# closing the tool and the timer setting the initial positions, prevented by
+# using a QWeakPointer<QWidget> instead of a raw QWidget *)
+Patch2:         qtoctave-0.10.1-initialposition.patch
 
 %description
 QtOctave is a frontend for Octave based on Qt4.
@@ -88,6 +93,9 @@ fi
 %exclude %{_datadir}/doc/octave-html
 
 %changelog
+* Thu Oct  6 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.10.1-5
+- fix crash when closing a dock tool within the first 5 seconds (#722986)
+
 * Thu Oct  6 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.10.1-4
 - fix *.m filters in file dialogs (debian#620062, patch by Sébastien Villemot)
 


More information about the scm-commits mailing list