Kodi Community Forum

Full Version: PATCH: Crash when importing music
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In some circumstances (which are unknown for me, but it happens for me though), XBMC crashes when a music library is selected. An assertion fails. I removed the assertion and replaced it with an if-construction, but maybe someone can trace down the real problem, what I'm not capable of because I lack the knowledge of how the system works. Anyway, you may want to include this patch in the SVN or apply it only when you have the same problem.

Code:
Index: guilib/StdString.h
===================================================================
--- guilib/StdString.h  (revision 10954)
+++ guilib/StdString.h  (working copy)
@@ -872,21 +872,21 @@
                        SSCodeCvt::result res   = SSCodeCvt::ok;
                        const SSCodeCvt& conv   = SS_USE_FACET(loc, SSCodeCvt);
                        SSCodeCvt::state_type st= { 0 };
-                       res                                             = conv.in(st,
-                                                                              pSrcA, pSrcA + nSrc, pNextSrcA,
-                                                                              pDstW, pDstW + nDst, pNextDstW);
+                       res = conv.in(st,pSrcA, pSrcA + nSrc, pNextSrcA,pDstW, pDstW + nDst, pNextDstW);

-                       ASSERT(SSCodeCvt::ok == res);
-                       ASSERT(SSCodeCvt::error != res);
-                       ASSERT(pNextDstW >= pDstW);
-                       ASSERT(pNextSrcA >= pSrcA);
+                       if (SSCodeCvt::ok == res)
+                       {
+                               ASSERT(SSCodeCvt::error != res);
+                               ASSERT(pNextDstW >= pDstW);
+                               ASSERT(pNextSrcA >= pSrcA);

-                       // Null terminate the converted string
+                               // Null terminate the converted string

-                       if ( pNextDstW - pDstW > nDst )
-                               *(pDstW + nDst) = '\0';
-                       else
-                               *pNextDstW = '\0';
+                               if ( pNextDstW - pDstW > nDst )
+                                       *(pDstW + nDst) = '\0';
+                               else
+                                       *pNextDstW = '\0';
+                       }
                }
                return pDstW;
        }
It could be the background musicloader thread - does it occur when you enter a directory with music that may have been scanned into the music library in the past?

Cheers,
Jonathan
jmarshall Wrote:It could be the background musicloader thread - does it occur when you enter a directory with music that may have been scanned into the music library in the past?

Cheers,
Jonathan

Negative, it occurs when you load the library. That is, when you open the root music folder you just added for the first time (and every time thereafter because it scans it again).