]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/mplexpholder.c
Update cfg_kludge_flash for Flash 10
[ion3.git] / ioncore / mplexpholder.c
index 3cbf5fdc2fa46a87471482c2d71502780fcae14a..2c8461eeade2e9d93d001d973b159ee9ec81e521 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ion/ioncore/mplexpholder.c
  *
- * Copyright (c) Tuomo Valkonen 2005-2007
+ * Copyright (c) Tuomo Valkonen 2005-2009
  *
  * See the included file LICENSE for details.
  */
@@ -84,17 +84,21 @@ void mplexpholder_do_unlink(WMPlexPHolder *ph, WMPlex *mplex)
         UNLINK_ITEM(ph->after->phs, ph, next, prev);
     }else if(mplex!=NULL && on_ph_list(mplex->misc_phs, ph)){
         UNLINK_ITEM(mplex->misc_phs, ph, next, prev);
-    }else{
+    }else if(ph->prev!=NULL){
         WMPlexPHolder *next=ph->next;
-        
-        if(ph->prev!=NULL)
-            ph->prev->next=next;
+
+        ph->prev->next=next;
 
         if(next==NULL){
             next=get_head(ph);
             assert(next->prev==ph);
         }
         next->prev=ph->prev;
+    }else{
+        /* ph should not be on a list, if prev pointer is NULL (whereas
+         * next alone can be NULL in our semi-doubly-linked lists).
+         */
+        assert(ph->next==NULL);
     }
     
     ph->after=NULL;
@@ -260,7 +264,7 @@ static WRegion *mplexpholder_attach_recreate(WMPlexPHolder *ph, int flags,
     WRegionAttachData data2;
     WFramedPHolder *fph;
     WPHolder *root;
-    WRegion *frame;
+    WRegion *res;
     RP rp;
     
     rp.ph_head=get_head(ph);
@@ -281,15 +285,17 @@ static WRegion *mplexpholder_attach_recreate(WMPlexPHolder *ph, int flags,
     data2.u.n.fn=recreate_handler;
     data2.u.n.param=&rp;
     
-    frame=pholder_do_attach(fph->cont, flags, &data2);
+    res=pholder_do_attach(fph->cont, flags, &data2);
     
-    if(frame!=NULL){
+    if(res!=NULL){
         rp.ph_head->recreate_pholder=NULL;
         /* It might be in use in attach chain! So defer. */
         mainloop_defer_destroy((Obj*)fph);
     }
     
-    return rp.reg_ret;
+    return (flags&PHOLDER_ATTACH_RETURN_CREATEROOT
+            ? (WRegion*)res
+            : rp.reg_ret);
 }