LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File qtoctave-0.10.1-initialposition.patch of Package qtoctave (Project home:stecue)

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;
 };