[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Karbon view splitting.
From:       Pierre Stirnweiss <pierre.stirnweiss_koffice () gadz ! org>
Date:       2005-06-13 18:15:13
Message-ID: 200506132014.48570.pierre.stirnweiss_koffice () gadz ! org
[Download RAW message or body]

On Friday 10 June 2005 23:20, Pierre Stirnweiss wrote:
> On Friday 10 June 2005 20:49, Thomas Zander wrote:
> > On Friday 10 June 2005 21:59, Pierre Stirnweiss wrote:
> > > Karbon crashes when in splitted view mode. I have now a SVN account but
> > > an not sure I am allowed to commit to branch.
> >
> > Technically; you can.
> >
> > > I want to remove the menu entry for splitting the view in Branch so we
> > > do not have a crashable program.
> >
> > I'd much rather have you fix it or come with your finding to the list (or
> > irc) to discuss why it crashes so we can fix it together.
> >
> > btw. it doesn't crash here.
>
> It is not the splitting that makes it crash. It crashes when inserting a
> new object or changing the fill or stroke. I have already posted on this
> with a very early theory. It actually crashes on the painter in the
> fillStrokePreview. It seems the painter (m_painter) for one of the view has
> been destroyed and the software still try to use it.
> I will need to understand first how views are getting created... before I
> can see what is happening.

Here is what happens: on splitting, a new view is created. A pointer to the 
fillStrokePreview is stored in each KarbonView class. However, the 
fillStrokePreview is a GUI element and is created by the createContainer 
method (called by the GUI merging and creation mechanism). When changing the 
active part/view in the splitter, the GUI is destroyed and recreated. 
Therefore, the fillStrokePreview is deleted and a new one is created. 
However, the local copy (in the KoView class) of the pointer still points to 
the old address. When the selectionChanged method is called on each view (on 
item insertion for example), the fillStrokePreviews are updated using the 
copied pointer leading to the crash.
The proposed solution is to update the fillStrokePreview only on the active 
view. This is what the patch does. The patch compiles and it does not seem to 
introduce new problems (I also tried with an embedded Karbon object in 
KWord).

Is it OK to commit in both branch and trunk?

Pierre

>
> > > Is it OK to change the karbon.rc file in branch to remove this option
> > > all together?
> >
> > That would really be my last choice.
>
> Yes but I am not sure I can debug that one before release, so better a
> Karbon without splitting that crash for release. I will then have time to
> debug it in head and backport the fix if need be.
>
> Pierre
>
> _______________________________________________
> koffice-devel mailing list
> koffice-devel@kde.org
> https://mail.kde.org/mailman/listinfo/koffice-devel

["karbon_view.patch" (text/x-diff)]

Index: karbon_view.cc
===================================================================
--- karbon_view.cc	(revision 422848)
+++ karbon_view.cc	(working copy)
@@ -1147,8 +1147,12 @@
 
 		if( count == 1 )
 		{
-			m_strokeFillPreview->update( *obj->stroke(), *obj->fill() );
-			m_smallPreview->update( *obj->stroke(), *obj->fill() );
+			if ( shell() ) {
+				if ( this == shell()->rootView() || koDocument()->isEmbedded() ) {
+					m_strokeFillPreview->update( *obj->stroke(), *obj->fill() );
+					m_smallPreview->update( *obj->stroke(), *obj->fill() );
+				}
+			}
 			m_strokeDocker->setStroke( *( obj->stroke() ) );
 			VGroup *group = dynamic_cast<VGroup *>( part()->document().selection()->objects().getFirst() );
 			m_ungroupObjects->setEnabled( group );
@@ -1160,11 +1164,13 @@
 			VStroke stroke;
 			stroke.setType( VStroke::none );
 			VFill fill;
-			m_strokeFillPreview->update( stroke, fill );
-			m_smallPreview->update( stroke, fill );
+			if ( shell() )
+				if ( this == shell()->rootView() || koDocument()->isEmbedded() ) {
+					m_strokeFillPreview->update( stroke, fill );
+					m_smallPreview->update( stroke, fill );
+				}
 			m_groupObjects->setEnabled( true );
 		}
-
 		part()->document().selection()->setStroke( *obj->stroke() );
 		part()->document().selection()->setFill( *obj->fill() );
 		m_setLineWidth->setEnabled( true );
@@ -1175,11 +1181,12 @@
 	}
 	else
 	{
-		m_strokeFillPreview->update( *( part()->document().selection()->stroke() ),
+		if ( shell() )
+			if ( this == shell()->rootView() || koDocument()->isEmbedded() )
+			m_strokeFillPreview->update( *( part()->document().selection()->stroke() ),
 									 *( part()->document().selection()->fill() ) );
 		m_setLineWidth->setEnabled( false );
 	}
-
 	emit selectionChange();
 }
 void


_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic