← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/bug-1016843 into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/bug-1016843 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1016843 in OpenLP: "OpenLP crash when creating new theme with items in service"
  https://bugs.launchpad.net/openlp/+bug/1016843

For more details, see:
https://code.launchpad.net/~j-corwin/openlp/bug-1016843/+merge/112229

Reduce the number of times a new QWebView is created, which seems to prevent OpenLP from crashing when creating a new theme and there are a lot of items in the service. 

I have no idea why this stops the problem!

(It was crashing in renderer:_text_fits_on_slide() in the evaluateJavascript() call, but this would process the same song fine if it was earlier in the service)
-- 
https://code.launchpad.net/~j-corwin/openlp/bug-1016843/+merge/112229
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/bug-1016843 into lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2012-06-22 14:14:53 +0000
+++ openlp/core/lib/renderer.py	2012-06-26 21:48:34 +0000
@@ -82,6 +82,7 @@
         self._calculate_default()
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
+        self.web = None
 
     def update_display(self):
         """
@@ -397,6 +398,10 @@
             The footer text block.
         """
         log.debug(u'_set_text_rectangle %s , %s' % (rect_main, rect_footer))
+        if not self.web:
+            self.web = QtWebKit.QWebView()
+            self.web.setVisible(False)
+            self.web_frame = self.web.page().mainFrame()
         self._rect = rect_main
         self._rect_footer = rect_footer
         self.page_width = self._rect.width()
@@ -404,10 +409,7 @@
         if theme_data.font_main_shadow:
             self.page_width -= int(theme_data.font_main_shadow_size)
             self.page_height -= int(theme_data.font_main_shadow_size)
-        self.web = QtWebKit.QWebView()
-        self.web.setVisible(False)
         self.web.resize(self.page_width, self.page_height)
-        self.web_frame = self.web.page().mainFrame()
         # Adjust width and height to account for shadow. outline done in css.
         html = u"""<!DOCTYPE html><html><head><script>
             function show_text(newtext) {

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2012-06-22 14:14:53 +0000
+++ openlp/core/lib/serviceitem.py	2012-06-26 21:48:34 +0000
@@ -178,7 +178,7 @@
             self.renderer.set_item_theme(self.theme)
             self.themedata, self.main, self.footer = self.renderer.pre_render()
         if self.service_item_type == ServiceItemType.Text:
-            log.debug(u'Formatting slides')
+            log.debug(u'Formatting slides: ' + self.title)
             for slide in self._raw_frames:
                 pages = self.renderer.format_slide(slide[u'raw_slide'], self)
                 for page in pages:


Follow ups